Can I use Tortoise SVN with Subversion?

This page is showing a generic answer.
To see a more detailed answer customized for you, type your domain name here:

You can use the Tortoise SVN software as a graphical front end to Subversion. Tortoise SVN is available for Windows computers and can be downloaded for free from their website:

http://tortoisesvn.tigris.org/

Installing and configuring Tortoise SVN is a fairly complex process and only recommended for advanced users. In particular, there are several different stages and programs involved, and you also need to be comfortable with using the command line.

These instructions assume that you want to configure Tortoise SVN on your Windows computer to connect to an SVN repository in your account on our server.

The main stages are as follows:

Save a PuTTY session

First of all, make sure you can use PuTTY to connect to your account's shell. Be sure to follow all of the steps on this page to get started with PuTTY and learn how to create and save a PuTTY "session". Also, be sure to select the "Connection -> Data" category on the left-hand side of the PuTTY window, then enter "example.com" into the "Auto-login username" field on the right.

Here is a summary of the values needed for your PuTTY session:

  • In the "Session" category:
    • "Host Name": example.com
    • "Port": 22
    • "Connection type": SSH
  • In the "Connection -> Data" category:
    • "Auto-login username": example.com

When you have entered all the values, test the session to make sure that it works. Then save the session. The name that you save it to will be used later by Tortoise SVN to retrieve the settings necessary to connect to your server. For the sake of this example, we assume that you will save the session with the name "svn-session".

Create an SSH key

Tortoise SVN can use SSH keys to authenticate your connection with Subversion on our servers. Although it is possible to use Tortoise SVN without creating SSH keys, the program will repeatedly ask you for the password. Most users find this time consuming and annoying, so we recommend creating keys, and the remaining instructions assume that you have done this.

To create the keys, login to your account using SSH and run the following command:

ssh-keygen -b 1024 -t dsa -f mykey

Enter a password ("passphrase") when it asks. The passphrase can be any string, and can be different than your main account password. This will create two files, named "mykey" and "mykey.pub". Then create a new directory named ".ssh" by typing this (don't forget the leading dot):

mkdir .ssh

Note: if you already have an .ssh directory, then you may already have a file within it called "authorized_keys". Use this command to see if you do:

ll .ssh

If you do, then you will need to add the contents of mykey.pub to the existing authorized_keys file.

Otherwise, if you do not have an existing .ssh/authorized_keys file, then move your public key file (mykey.pub) into the .ssh directory, renaming it to "authorized_keys":

mv mykey.pub .ssh/authorized_keys

Now you need to download the private key (named "mykey") onto your own computer. You can either create an FTP connection to your home directory, or you could simply copy-and-paste it from the server (do "cat mykey") to a new text file on your own computer — it's only a few lines of text.

After you have the "mykey" file on your own computer, you can (and should) delete it from the server; only the public key file (now called "authorized_keys") needs to be there.

Convert the private key using Puttygen

Start the Puttygen program, (puttygen.exe) and choose the "Load" option. Then change the filter to "All files" so that the Windows dialog box allows you to select the private key "mykey".

Puttygen will then ask you for the "passphrase", enter this so that it can import the key. Now choose the "Save private key" option and save it in PuTTY's native format as "mykey.ppk" and take a note of the location.

Now open PuTTY and load the "svn-session" session. Go to the "SSH -> Auth" category and add the "mykey.ppk" key to the "Private key file for authentication" box. Finally go back to the "Session" category and click "Save". PuTTY should now remember to use your private key in the future for that connection.

It should now be possible to connect to the server using the passphrase and key, not the main SSH account password.

Add the private key to Pageant

Pageant is a PuTTY program that unlocks your SSH key whenever another program (such as Tortoise SVN) needs it, without forcing you to type the key password over and over again.

Open Pageant (pageant.exe), which will start running in the background. Right-click on the icon that Pageant adds to your Windows toolbar, then choose "Add Key" to add the "my-key.ppk" key file. When prompted enter your passphrase for the key. Once you have done this, Pageant will silently provide your passphrase in the background whenever needed.

You will need to make sure Pageant is loaded each time you restart your computer.

Install Tortoise SVN

Download and install Tortoise SVN from their website.

Once installed, you should be able to access Tortoise SVN commands by right-clicking in a Windows Explorer file window.

To initially checkout a SVN project, navigate to the folder into which you would like to check out the SVN files. Right-click the mouse and choose "SVN Checkout...". Then for the "URL of repository" enter the following and click "OK" to checkout the repository:

svn+ssh://svn-session/home/ex/example.com/svn/project-directory

...where svn and project-directory are the appropriate parts of the path to your Subversion repository. If your SVN repository is in a different location, then change the path after "svn+ssh://svn-session/" accordingly.

That's it, Tortoise SVN should now work using the SSH key and passphrase that you created!