To make things easier, we can tell git to use the PuTTY tools rather than the built in ssh client. The PuTTY tools include an identity manager and an SSH replacement.
Follow these four steps:
-
Download and install PuTTY using the MSI installer package from the PuTTY download page. Alternately, you can just get the "PLink" and "Pageant" executables from the same page and save them somewhere in your path.
-
Add a new user or system environment variable:
- Press Windows+R and enter
sysdm.cpl
- Select the 'Advanced' tab
- Press the 'Environment Variables' button at the bottom of the window
- In the new dialog that appears create a new user or system environment variable named GIT_SSH
- Set the value to the full path for plink.exe, for example
C:\Program Files\PuTTY\plink.EXE
Open a new command prompt for the following steps. This needs to be a new command prompt, after you added the environment variable, so the GIT_SSH value is set.
-
Run
pageant your_key.ppk
(replace 'your_key.ppk' with the path and name of your PuTTY key file). If your key is password protected, pageant will ask you to enter your password. -
PuTTY / plink needs to verify the host before it lets you attach to it. Unfortunately git doesn't pass the keyboard input back to plink so you'll need to do a one-time connection to github.com in order to get plink to add the fingerprint to the known_hosts file.
This is a one-time configuration. You wont need to do this again on the same machine unless github.com changes their server fingerprint (unlikely, but possible).
Run plink [email protected]
and wait for the fingerprint prompt
The server's host key is not cached in the registry. You
have no guarantee that the server is the computer you
think it is.
The server's rsa2 key fingerprint is:
ssh-rsa 2048 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48
If you trust this host, enter "y" to add the key to
PuTTY's cache and carry on connecting.
If you want to carry on connecting just once, without
adding the key to the cache, enter "n".
If you do not trust this host, press Return to abandon the
connection.
Store key in cache? (y/n)
Press 'y' in response to this prompt and plink will continue with
Using username "git".
Access granted. Press Return to begin session.
Press enter at this prompt and plink will respond with
Server refused to allocate pty
Hi [your username]! You've successfully authenticated, but GitHub does not provide shell access.
You can now use git like you would on any other operating system. Commands like git clone
, git pull
, git push
, git branch -a
, etc. that access the upstream repository will now work correctly.
Be sure it says 'Clone with SSH or select the 'Use SSH' option in github when cloning a repo. PuTTY / plink / pageant can't help you with an https cloned repo.
It appears that you do not have your key loaded in memory. You MUST load your key in memory via the pageant command (see step 3).
The other possibility is that you don't have a key registered with github.