Setting up password-less connection in TortoiseGit

Both mysysgit and TortoiseGit are password-less in the meaning, that they don’t store any passwords. If you want to avoid typing your GitHub login password and over and over again, the only option is to setup password-less login using SSH keys. This article is my personal check-list on how to configure each computer as painlessly as possible.

tl;dr Read this great article, if you’re new to this things or this StackOverflow answer, if you’re experienced enough and only require technical details.

The check-list

Follow these steps:

1. Run Puttygen from TortoiseGit’s folder or from PuTTY’s folder or get it from PuTTY’s website. Make sure, that SSH-2 RSA is checked as Type of key to generate in Parameters section in lower part of Puttygen.

2. Generate your keys pair, by clicking Generate and moving a mouse pointer around blank area.

3. Copy entire generated public key to Clipboard. Open GitHub’s SSH Settings page, login, click Add SSH key, give new key some name and paste your public key to the field. Click Add key and confirm using your account’s password to continue.

4. Go back to Puttygen, click on Save private key and write your private key in some safe place (like TortoiseGit’s installation dir). Using passphrase to secure your private key is optional, but highly recomended.

4a. (optional; to verify key) Run Pageant from TortoiseGit’s folder (Start Menu). It will set a traybar icon (next to clock). Double click it. Click Add Key in opened window and select your saved private key.

5. Open GitHub, visit repository main page and copy SSH address (using HTTPS will fail!).

6. Clone any repo from GitHub or create any local one and push changes to GitHub to add new remote for selected repo in TortoiseGit. If asked for a private key, provide location of just save file.

7. Browse to your repo on disk (cloned or local), right click it and select TortoiseGit > Settings. Selecting repository is necessary, to get access to selected repo settings, not the global TortoiseGit settings.

8. In Settings window you should have access to Git > Remote tree branch. Select it. Then select your remote (usually orgin) in Remote list.

9. Change URL form HTTP version to SSH, if you haven’t done this yet. Click on ... in Putty Key filed and point TortoiseGit to location of your private key. Click OK to confirm.

You’re done! Try pulling repo. If everything is OK, you shouldn’t be asked for login and password.

If you use SSH access for the first time, you will probably be asked for adding GitHub server to local cache. This is done only once (ever). If you used passpharse on your key pairs, you’ll be asked to provide it, but it is also done only once (per each computer restart).

Final words

This is the shortest path. For TortoiseGit you can get more detailed information along with example screenshots at Dancing Monkeys Accelerated blog. It is more focused on newbies. You can also read this StackOverflow answer, but requires much more experience (and doesn’t have cool pictures! :]).

If you decide to use this way, please remember to change your remote repository URL from HTTP to SSH or else you’ll be prompted for password even after successfully creating SSH keys pair.

Leave a Reply