Access GitHub on Windows using Plink

20 Jan 2011

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:

  1. 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.
  2. 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, select Import key and load your OpenSSH private key. Then, click the Save private key button to save the key in .ppk format.
    • PuTTYgen also obviously works for making new keys.
  3. 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.
  4. 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.

With Pageant running, I tested to make sure the above steps worked by using Git Bash to access a remote repository.

All of the tools mentioned can be found on the PuTTY Download Page.