5

Apologies in advance for the basic question - I'm new to git and am sure that I'm missing something super easy that someone could answer very quickly.

During the msysgit installation I specified that I would like to use PLink instead of OpenSSH as my secure shell client program. The environment variable 'GIT_SSH' is set to 'C:\Program Files (x86)\PuTTY\plink.exe', which is the correct path to plink. I've tried with and without quotes. "echo $GIT_SSH" from the bash prompt displays the correct value for the environment variable. I am also able to connect to github via SSH using putty with no problems.

After starting pagent and adding my private key, I opened a new git bash window and attempted to connect to github (github already has my public key and is correctly setup - I'm using the jquery project as a quick test). Despite specifying that I want to use PLink and apparently having the correct environment variables set, msysgit is still attempting to use the key files found in the ~/.ssh directory.

I've confirmed this by actually putting my private key in that directory and everything works perfectly (I was able to clone the jquery repository with no problems at all), but I'd really like to get this set up so I can manage my private keys through putty if possible.

Not really sure what I'm missing.. Any help is very much appreciated - thanks in advance!

2 Answers 2

7

I had similar problems and the solution is that you have to use 'plink' and not 'ssh'.

So the following commands (from the bash prompt) should work for you (assuming you've setup a GitHub SSH key):

$ echo $GIT_SSH
C:\Program Files (x86)\PuTTY\plink.exe

$ "$GIT_SSH" -V
plink: Release 0.62

$ "$GIT_SSH" -ssh [email protected]
Using username "git".
Server refused to allocate pty
Hi [your-github-username]! You've successfully authenticated, but GitHub does not provide s
hell access.

If you just run "$GIT_SSH" then it will print out the arguments that you can use. The -ssh command forces PuTTY to use the ssh protocol.

If you've got C:\Program Files (x86)\PuTTY\ in the PATH then you should just be able to run plink -ssh user@host

The reason for this is that the ssh command uses OpenSSH and OpenSSH doesn't recognise PuTTY keys.

plink.exe is actually mentioned in the first solution in the most up voted answer for Git / PuTTY configuration questions, its just hard to spot.

1

For me the solution was that the path needed to be specified in linux style, like so:

set GIT_SSH=/c/PuTTY/plink.exe

Which was pretty confusing since I am setting the environment variable in Windows syntax but the value is a Linux style path.

Key point is:

echo $GIT_SSH
C:\Program Files (x86)\PuTTY\plink.exe   <-- not a valid path in bash shell

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.