After installing Git and TortoiseGit for use with GitHub on my home pc, I was hooked. But for some reason, the same thing wouldn’t work on my pc at work.

TortoiseGit throws an error when syncing with GitHub

This seems to have something to do with Windows not playing well with Gits authentication system.

However, I’ll try to do my best and explain here how you can resolve this issue, to get you back up and running.

Note: in this tutorial, I’m using an SSH key with a passphrase. This causes the used applications to ask for the passphrase during the tutorial and once each time you log in to Windows. If you don’t want to enter a passphrase each login, you can choose to use a SSH key without a passphrase. This will be less secure, anyone who has your key can use it to access your repository.

Step 1.

The first step is to install PuTTY and its related applications, from the putty homepage. Install at least PuTTYGen and Pageant, we’ll need those later on.

Install PuTTY using the Windows installer

Step 2.

Once you’ve installed the PuTTY tools, start PuTTYGen and load your private key via Conversions -> Import key. Your private key will be located at one of the following locations:

Windows XP: C:\Documents and Settings[username].ssh
Windows Vista/7: C:\Users[username].ssh

Import your private ssh key with PuTTYGen

Step 3.

If you have a SSH key with a passphrase, you will be prompted to enter it now.

Enter your passphrase if your SSH key requires one

Step 4.

Once the key is loaded, save the private key as id_rsa.ppk, in the same folder as the other keys. This is basically the same key as the one you loaded, but in PuTTY’s format.

When the key is loaded into PuTTYGen, save the private key as .ppk

Save the key in the same folder as the other keys

Step 5.

Copy the public key from the textbox, entitled ‘Public key for pasting into OpenSSH authorized_keys file:’. Go to your GitHub page and open 'SSH Keys’ under 'Account Settings’ and add the key there.

Copy the public key from PuTTYGen for use on GitHub

Add the public ssh key to your account at GitHub

Step 6.

We’re done with PuTTYGen, now it’s time to make the key load at login. Add a shortcut to Pageant in your Startup folder.

Add a shortcut to pageant in your Startup folder

Step 7.

Open the properties of the shortcut and edit the target path. Append the path to the private key we just created. The full path should look something like this:

Windows XP: “C:\Program Files\PuTTY\pageant.exe” “C:\Documents and Settings[username].ssh\idrsa.ppk”
Windows Vista/7: “C:\Program Files\PuTTY\pageant.exe” “C:\Users[username].ssh\id

Step 8.

Close the properties window and start Pageant using the same shortcut. If all went well and if you’re using a key with passphrase, you should be prompted to enter it now.

Enter your passphrase for Pageant if your SSH key requires one

Step 9.

To verify we’ve done everything right, open up Pageant using the icon in the taskbar, by double clicking it or right click -> View keys. This will open a list with all loaded keys, which in our case is only one.

The loaded keys in Pageant

That’s it! If the key is loaded, we can now use Git to sync with the GitHub servers. Additionally, each time Windows is booted and logs in, our SSH key will be loaded, prompting for a passphrase if using one.