Ssh – TortoiseGit using private key (non-root user)

gitssh

I have a debian server with some git repositories. I've generated two keys using

keygen -t rsa

That gave me root.pub and user.pub files. The root.pub was appended to /root/.ssh/authorized_keys and user.pub to /home/user/.ssh/authorized_keys.

I've converted keys to putty format (ppk): root.ppk and user.ppk. Now I am able to login as both root and user with these keys using putty – everything works fine!

The magic comes when it is about TortoiseGit (the latest release). I've set two remotes:

[remote "user"]
    fetch = ...
    url = ssh://user@server/path
    puttykeyfile = C:\\path\\user.ppk
[remote "root"]
    fetch = ...
    url = ssh://root@server/path
    puttykeyfile = C:\\path\\root.ppk

With root.ppk everything works fine – I can push and pull to my repositories without entering the password. But user.ppk is failing – I get TortoisePLink window with password prompt.

There is nothing in /var/log/auth.log. I am completely stuck. Does TortoiseGit (or Windows) require some more configuration?

UPDATE: Seems TortoiseGit caches or stores the key somewhere. If I add root.pub to /home/user/.ssh/authorized_keys I can push/pull using both remotes no matter which key I specify in TortoiseGit settings. Killing TortoiseCache.exe, restarting pageant, rebooting windows machine has no effect.

It definetely stores the key somewhere. The ssh login uses root.ppk only no matter what I configure. So the question is "Where does TortoiseGit store ppk keys other than in .git/config"?

Best Answer

Did you actually mean this:

The root.pub was appended to /root/.ssh/authorized_keys and user.pub to /home/user/authorized_keys.

Because that shows that you put the user.pub in the wrong file - it syould be

/home/user/.ssh/authorized_keys