TortoiseSVN over SSH on Windows via PuTTY

TortoiseSVN over SSH on Windows via PuTTY

TortoiseSVN if you don't already know is an SVN (Subversion) client that allows you to run SVN commands right in windows explorer.  This is a nifty tool that can save you a ton of time.  You will spend more time working on your projects rather then hammering the keyboard on the command line trying to accomplish simple SVN tasks.

In this article I would like to explain the process of setting up TortoiseSVN on a windows machine to allow you to connect to your SVN repository over the SSH protocol using a pre-configured PuTTY session that uses a private key to authenticate to the server.  This can be done easily using a few free tools that you may even already have installed but, if not I have linked you to them in the tools section at the bottom of this article. 

Required Windows Applications

PuTTY - An SSH client
PuTTYgen - A PuTTY style key generator
TortoiseSVN - The ultimate in windows explorer SVN managemet

Creating authentication keys for SSH

In order to further secure the connection between your windows machine and your *nix machine lets create a public/private key pair that we can use for authentication. From a shell prompt on your *nix machine use the following command to generate the keys:

ssh-keygen -b 1024 -t dsa -N [password] -f [key_file_name]

Be sure to replace [password] with the password that you want to use for your private key and [key_file_name] with the actual name you want to assign your key file.

This will automatically generate two files with the name you specified.  One file will have a .pub extension on it which is your public key and is not encrypted.  The other file is your private key and this file needs to be copied to your windows machine.

Generate a new private key using PuTTYgen

Next we want to generate a private key that is usable by our PuTTY ssh client.  To do this let's run PuTTYgen and click the "Load" button.  Browse to the folder that you copied your private key to from your *nix system and open that file. 

Once you load the file you should be prompted with  a window similar to the following:

PuTTYgen Pasphrase Dialog

The password PuTTYgen is asking for is the one you set when you originally created the private key with the -N [password] switch.  Enter this password and this will allow PuTTYgen to de-crypt the private key and create it's own public/private key pair to use with ssh sessions. 

Once the keys are generated we need to copy the public key and append it to a file on our *nix machine at ~/.ssh/authorized_keys. One way to accomplish this would be to paste the public key into a file and upload that file to your *nix machine.  Now you can issue the following command to get your public key into the authorized_keys file.

$ echo /path/to/keyfile >> ~/.ssh/authorized_keys

Now when we connect using PuTTY (and later TortoiseSVN) using our private key for authentication it will match with the authorized_keys file so that we can gain secure access to the system.

Click the "Save private key" button now in PuTTYgen and save the private key somewhere so it can be accessed by PuTTY.  PuTTYgen will generate a file with a .ppk extension that we can use with PuTTY to setup our SSH session to the server.

Configuring PuTTY with a private key

We need to configure PuTTY with our private key so that we can save the session for TortoiseSVN to use later when we connect to the SVN server.  Within the PuTTY application go to the "Session -> Connection -> SSH -> Auth" category. 

 PuTTY Configuration

Click the "Browse..." button and select the ppk file that you just saved using PuTTYgen. 

Now return to the "Session" category so we can save our session. Be sure to remember the name you save the session as since we will use it when we connect through TortoiseSVN.

PuTTY Session

Once you have your Host Name and session name entered, click save. Now we can close our PuTTY window and move on to the TortoiseSVN configuration. Almost there : )

Configuring TortoiseSVN

Now for the home stretch of our setup process. Open up windows explorer and go to a directory where you might be willing to perform an SVN checkout.  Right click in your folder and select "TortoiseSVN -> Settings". This should bring up a window similar to the following:

TortoiseSVN Settings

Select the Network configuration and point the SSH client to TortoisePlink.exe.  If you installed TortoiseSVN to the default location your path should match what I have in the screenshot. 

Click OK and if everything went well we should be all set to do some SVN'ing.  

Go back to the folder that you were willing to do an SVN checkout in from earlier and right click again and select  "TortoiseSVN -> Repo browser".  This will prompt you for your SVN url.  The following format is what you will use:

svn+ssh://[username]@[putty saved session name]/path/to/repository

If the stars are aligned you should be prompted with the password for your private key by the TortoisePlink application.


Enter your password and you should be home free! Depending on the speed of your network and size of your repository you should recieve a listing of the repository path that you requested in the TortoiseSVN Repo browser. 

Summing up!

I hope this process worked for you as it did for me. If you run into any issues please feel free to shoot me a message using the contact form. I want to be sure that all of my articles are complete and work for everyone.  I must admit... this one took me awhile to figure out. There are bits and pieces of each part of the procedure here and there around the net but nothing from start to finish (at least at the time of this writing).  If this saves one person from forehead to keyboard full contact sports then I feel better already.

Happy SVN+SSH'ing! 







Boise Web Design

Established in the City of Trees in Boise Idaho in 2002, Vector Network Solutions is now a leading web development company providing Boise web design with over ten years of experience. Leading the way with a proven track record on the industries top web platforms, VectorNS is capable of delivering exceptional solutions to clients around the globe. Our strategic methods afford us the ability to provide Boise with web design, development and a sharp competitive edge. Call or e-mail today to start initiating your project with the experienced professionals at VectorNS.

Free Web Tips & Ideas!

Sign up for VectorNS Web Tips and recieve occasional tips & ideas to enhance your web presence.