Martin Martin - 29 days ago 7
Git Question

TortoiseGit using incorrect SSH key

I have a strange problem with tortoise git at the moment, which I can't figure out. When trying to commit to my repository on github I get the error


ERROR: Permission to martindevans/Hermes.git denied to key2


Key2 is a key I use to access a different github repository, however the remote url is not set to use key2, as you can see here it's set to use private.ppk

enter image description here

Am I doing something obviously wrong, or is tortoise git broken?

Nb. In response to the comments. Using normal git results in:

C:\Users\Martin\Documents\Visual Studio 2010\Projects\Hermes>git push
Permission denied (publickey).
fatal: The remote end hung up unexpectedly

Answer

There are different private key formats. My keypair was generated with puttygen, but my Tortoise was configured to use ssh.exe (form msysgit) as ssh-client. So i changed it to plink (from Tortoise) and it worked.

  • ssh-key.exe => ssh.exe (C:\msysgit\msysgit\bin)
  • puttygen.exe => TortoisePlink.exe (C:\Program Files\TortoiseGit\bin)

Additional note: Use the correct URL! Github offers you three URL https, git and ssh.


Edit:

I adapted the settings here:

Settings - TortoiseGit >> Network >> SSH-Client
C:\Program Files\TortoiseGit\bin\TortoisePLink.exe

I have generated the key-pair with:

 C:\Program Files\TortoiseGit\bin\puttygen.exe