Given a SSH only GIT Repo, was unable to git clone the repo, despite my public key being successfully stored in the remote repo's authorization_keys file. The git clone command invoked from within the git bash kept prompting for password, but could not authenticate for some bizarre reason. Thought it could be some proxy issue. But no, was able to ping successfully to the server hosting the git repo. Then came the saviour. Pageant.exe, which gets installed when PuTTy SSH client gets installed in windows. Pageant runs on the system tray and serves like a vault of .ppk keys. After adding my ppk to it, was able to successfully connect to the server using putty. Then I thought git clone will also work. But No. Apparently an environment variable GIT_SSH pointing to plink.exe (found within the putty installation directory) is needed. After adding that, I was able to git clone the repository without it prompting me for a password. So, in summary here are the steps:
  1. Install Putty (via Windows Installer to get all the tools in one go)
  2. Use PuttyGen to create a private/public key pair.
  3. Send the public key to the remote Git repo administrator so that it can be added to the ~/.ssh/authorization_keys file
  4. Once that is done, Run Pageant.exe (found in Putty installation directory. Mostly C:/Program Files (x86)/Putty)
  5. Right-click on the system tray of Pageant to view the keys and add the private key generated using PuttyGen
  6. Install Git for Windows
  7. Run Git Bash
  8. Navigate to the Putty installation folder (eg. $ cd "c:\Program Files (x86)\Putty)
  9. To test if the Pageant is working fine, execute the command $putty git@servername:gittreponame.git
  10. This will login you to the git server where you can $ cd ~/.ssh to see the authorization_keys file. If curious, to open it, use $cat ~/.ssh/authorization_keys and one of the keys in that would be your public key
  11. Now try $git clone git@servername:gittreponame.git and it might prompt you for a password. I tried to use the password associated with my private key, but did not work. Hence the following steps.
  12. Add GIT_SSH environment variable in Windows. The value for this should be the path to plink.exe which will normally be in the Putty installation folder.
    git_ssh 13. Then try $git clone git@servername:gittreponame.git and it should start the cloning without any prompts.