TortoiseSVN using Putty sessions

This article walks through the steps necessary for setting up TortoiseSVN to access a Subversion repository. By the end of this article, you will have a properly configured Tortoise SVN client. The process has these steps:

Install TortoiseSVN

Install PuTTY and PuTTYgen

Make your keys on the server

Make a profile in PuTTY

Do an SVN Checkout

Prerequisites

Before you begin, you need to be comfortable completing the following tasks:

Using the Dreamhost Panel

Using SSH to execute UNIX commands on your hosted server

Using basic UNIX commands like ls, pwd, chmod

Using a command line text editor like 'pico'

Installing Windows software

You also need to know the following:

Dreamhost Panel login and password

SSH shell login and password (it is likely different from the Dreamhost Panel login/password combo)

The path to your Subversion repository (if you don't have one, you need to make one)

When you have collected the necessary bits of information that you need to complete this process, you can proceed to the first step: Install TortoiseSVN

Install TortoiseSVN

Download TortoiseSVN

It takes a few clicks to find the download page. First click the 'Download' link in the 'Project Highlights' area near the top of the page, then click the 'Download Page' link on the subsequent page. Unfortunately, it is a small, hard-to-find link in the middle of the table. You can also just click this link:

If you are running a 32-bit Windows Operating System like Windows XP on an Intel Pentium then you should click the *.msi installer for i386 architecture. If you are running an AMD Athlon 64, by all means, install the 64-bit package.
Save the file to your desktop. If you are using Firefox, you can right-click the file and choose 'save link as...' from the menu to save the file.

Install TortoiseSVN

Installing the TortoiseSVN program is wizard based:

Double-click the *.msi file that you just downloaded.

The first screen is called 'Welcome to the TortoiseSVN Set-up Wizard'. Click 'Next'.

The second screen is the End-User License Agreement. Read the agreement, accept the terms and click 'Next'.

The next screen is to customize the installation. It warns you if there is not enough space on the hard disk. If you do ASP.net development, you should read the notices on this screen carefully. You can install the program into a different directory if necessary. Most people will not need to change any of the settings. Click the 'Next' button when you are satisfied with these settings.

The next screen warns you that the installion is about to begin. Click 'Next'.

The installer will then install the software and report on its progress using a standard progress bar.

When the installation has finished copying and configuring the files, you will see the 'Completing the TortoiseSVN Set-up wizard' screen. Click the 'Next' button.

The installer will need to reboot to finish the install. Save any open work and click 'Yes' to reboot your computer.

Errors can occur when the Tortoise installer needs to change files which are in use by other programs. The installer will prompt you to close the programs that are using the files. Close the applications when prompted and click 'Retry' to continue the installation.

In the Folder Tasks area, click the 'extract all files' link in the ZIP view of Windows Explorer

In the Extraction Wizard, click 'Browse...' to adjust the destination directory to point to:

C:\Program Files\Putty

Click 'Next'

Click 'Finish'

The files will open in a new window. You are done.

Adding PuTTY to Start Menu

PuTTY does not add the applications to the Start Menu automatically. You can do this manually in two ways.

You can pin the application to the Start Menu by right clicking on the application executable file (putty.exe for example) and choosing the 'Pin to Start Menu' option. The application will appear at the top of the Start Menu.

You can also add the applications to a folder in the Start Menu by creating shortcuts for all the applications and placing them in the Start Menu folder. You can make shortcuts by right-clicking the file and clicking 'Create Shortcut'. Once you have made shortcuts to the aplications you can move them to the the folder that is used to build the Start Menu. On most systems it is located here:

C:\Documents and Settings\All Users\Start Menu\Programs

Create a folder called 'Putty' or something similar and drop the shortcuts into the folder. They will appear in your Start Menu.

Make your keys on the server

Using your favourite SSH client, open a terminal window to your server at Dreamhost (our example uses fairfax as the server name):

fairfax.dreamhost.com

Present your username and password to authenticate your session.

Create your digital key pair by typing the following UNIX command (replace the yourname portion of the file name to a name of your choice):

ssh-keygen -t rsa -f yourname.key

The system will prompt you for a passphrase. Leave it blank and hit the return key.

It will ask you to repeat the passphrase. Again, leave it blank and hit the return key.

The system has created a public and a private key for you. They will be named yourname.key and yourname.key.pub and will be in the home directory.

Append your key to the authorized_keys file

You now need to copy the public key into the list of keys that are used to authenticate SSH sessions. Be very careful, you may accidently delete the keys of other users at this stage.

Back-up the authorized_keys file

There may be back-up copies of this file in the directory. Disk space is cheap, so just leave them there. You can use any file name for the back-ups. authorized_keys.bk12 is a fine file name for a back-up.

Change your working directory to the .ssh directory:

cd .ssh

Back-up the current authorized_keys file (it is a file without an extension - not a directory!)

Add your key to the authorized_keys file

Now open a text-editor to edit the authorized_keys file and add the public key that you just made to the end of the file. Type the following command:

pico authorized_keys

You will now be in pico, a simple text editor. Click the following key combinations:

Position your cursor at the end of the file

Hit return to create a new line. You will place your key here.

Click CTRL-R (Control key plus the 'R' key at the same time) to place a file at the cursor position

At the next prompt, click CTRL-T to go to the file navigator

Scroll down to select the public key that you made: yourname.key.pub

Click return to write that key into the file

Click CTRL-X to tell pico to exit

Click 'Y' when prompted to 'save modified buffer'

Click 'Return' at the file name prompt to keep the file name the same

You have added your key to the authorized_keys file. Done.

If you get complaints from your fellow programmers that they cannot get into their repositories, you can restore the old file by copying it back.

Don't delete the file for a few days to give everyone a chance to request a roll-back!

Now make sure permissions are set properly for all necessary files and directories:

chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys

Copy your keys

You should copy both of your keys from the server and store them somewhere safe. You can use a SFTP client for this; I use SSH Secure Shell, others use FileZilla. Included in the PuTTY ZIP archive is a simple command line SFTP utility called PSFTP. You can start that program and type the following session:

You may also want to remove the keys from the home directory of the server. If you do not know how to delete files safely, get some help from your system administrator or skip this step and leave them on the server.

Make a profile in PuTTY

Now that you have your keys on your local machine you need to create a saved PuTTY session which will allow you to make commits to your repository without having to authenticate each time.

Convert your private key

Putty needs to convert your private key into a format that it can use to authenticate against your server. In this section, you will make a Putty Private Key (PPK) file that you can use within Putty.

Follow these steps to convert your key:

Launch PuTTYgen

Select 'Conversions' | 'Import key' to select a key for conversion

C:\yourname.key

Click 'Save private key', a dialogue box will warn you about an empty passphrase

For public repositories, it is acceptable to have private keys with empty passphrases, so click 'yes'

A save file dialogue box will open and you will be prompted for a name. Enter a suitable name

C:\yourname.ppk

Close PuTTYgen

Verify that your private key file was created, open Windows Explorer to find the file or type into a command window

If you find your Putty Private Key (PPK) file in your local file system then you are done.

Create a Putty profile

Follow these steps:

Launch PuTTY, you will see the 'Putty Configuation' screen

Ensure that 'Session' is highlighted in the left tree navigation (it should be highlighted by default)

Put your Subversion host name in the Putty 'Host Name' text box

userid@svn.my-great-project.your-domain.com

Ensure that the port is 22 and the SSH radio button is pressed (it should be by default)

In the left tree navigation, open the 'Connection' node, then the 'SSH' node, then highlight 'Auth'

In the 'Options controlling SSH authentication' panel, click the 'Browse...' button to find the PPK file you made with PuTTYgen and select it

The filename should now be in the 'Private key file for authentication' text box

In the left tree navigation, open the 'Session' node

In the 'Load, save or delete a stored session' area, there is a textbox below the label 'Saved sessions', place your cursor in it

Decide on a one word name for your session, we will use the word 'mysession' for our example, type it in the text box

Click 'Save' to save the session - a configured session has now been stored

Click the 'Open' button to open a PuTTY session

If a PuTTY session opens and you are not challenged for a user name and password, then you are done (if not go back and try again)

Type logout to close the session, you are done setting up a stored PuTTY session!

Do an SVN Checkout

You will now use the stored PuTTY session to present your credentials to the Subversion server. This will allow you to avoid all the annoying password prompts each time you try to access the Subversion server.

Open a Windows Explorer window (The Windows Key + E is a quick keyboard shortcut)