Access GitHub on Windows using Plink
I came across this discussion on GitHub’s support forum while setting up a msysgit installation to be able to access GitHub. The post claims GitHub does not support PuTTY’s set of tools for allowing msysgit to authenticate and interact with GitHub’s servers. It suggests that OpenSSH should be used instead. Since I’ve been happy with PuTTY, I decided to dig deeper. It’s actually fairly straightforward to configure PuTTY to work with msysgit. Here are the steps I took to do so in my environment:
- I ensured that a
GIT_SSH
environment variable was set to a path to the Plink executable. If TortoiseSVN is already installed, the msysgit installer will offer to set this variable to TortoiseSVN’s Plink, which works just as well. - A public/private key pair is needed for SSH authentication. I opted to use a previously generated pair. Since my keys were generated using OpenSSH
ssh-keygen
on Linux, I converted my private key to PuTTY’s .ppk format.- To convert an existing key, I used PuTTYgen. Under the
Conversions
menu, selectImport key
and load your OpenSSH private key. Then, click theSave private key
button to save the key in .ppk format. - PuTTYgen also obviously works for making new keys.
- To convert an existing key, I used PuTTYgen. Under the
- With my private key properly converted, I ran Pageant and added the key. Pageant must remain running while interacting with GitHub’s or any other protected server’s remote repositories.
- Finally, I ensured that my GitHub account was configured with the correct public key. This is done through the
Account Settings->Account Overview->SSH Public Keys
menu on GitHub.