This is a tutorial on how to set up the public key infrastructure to access SVN repos from
The basic idea is that we generate a pair of keys - private and public - the public key we give away and the private one should always be safely stored in our system.
Keep in mind that authentication will only succeed if the SVN server has your public key. Usually, you can just send the file to our system administrator.
We assume that the URL of the repo that we want to connect to is email@example.com/reponame, where
reponame will be different for each repo.
In Linux the keys are usually stored in
~/.ssh, the private key is per default named
id_rsa and the public one
$ ls ~/.rsa
$ sudo apt-get install openssh-client
$ ssh-keygen -t rsa
The password is optional. For more information on generating keys use
ssh-keygen –help or
svn co svn+ssh://firstname.lastname@example.org/reponame
In Windows we will need the following two programms: PuTTY and Tortoise-SVN. the official download pages are http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html and http://tortoisesvn.net/downloads.de.html. The easiest way to get all the parts of PuTTY we need is to use the installer from the download page (version can be different):
Now we have to create a pair of keys. Launch PuTTYgen which was installed with the PuTTY-installer (default location:
C:\Programm Files (x86)/PuTTY/). We can leave the settings as they are and click on generate.
Keep moving the mouse in the blank area until the progress bar is full.
Now we create a folder in our user directory with the name
In this folder we save the public key as
id_rsa.pub and the private key as
IMPORTANT: Please send the full text (beginning with ssh-rsa…) below “Public key for pasting into OpenSSH authorized_keys file:” to our sysadmins: email@example.com
After that we create a shortcut on the Desktop of the pageant.exe which should be in the same folder as the PuTTYgen.exe (by default:
C:\Programm Files (x86)/PuTTY/). Right-click the shortcut and open the
Properties. There in the end of the target line add
“$PATH/ssh/id_rsa.ppk” (replace $PATH with the path to your user directory). Don't forget the double quotes!
Next we can move the shortcut we just created to our startup folder (Autostart on german Windows) in the startmenu. Note: If you don't want to add pageant to your startup folder, please make sure that you've started pageant with the desktop shortcut created BEFORE interacting with SVN. This has to be done once everytime after you reboot your machine.
Now restart your PC. If you set a passphrase for your key you have to type it in from now on when you boot your PC.
If not there will only be a symbol in your taskbar.
Next we use PuTTY to configure a SSH connection (should be in the same directory as pageant and PuTTYgen). Under Session we specify the username and the hostname of the SVN repository. Enter “svn” below “Saved sessions” to give this configuration a name and press on “Save”. After saving the session configuration, press on “open” to connect to the SVN.
Log in using the username
svn. If the server has our public key this should be successful and will show an output similar to this:
X11 forwarding request failed on channel 0 PTY allocation request failed on channel 0 ( success ( 2 2 ( ) ( edit-pipeline svndiff1 absent-entries commit-revprops depth log-revprops partial-replay ) ) )
After we configured pageant in step 3 we are now ready to checkout an SVN-repository. To do that we open an explorer and go to the directory where the reporitory should be placed. Then we right-click in the windows and click on
Now we pass in the URL where the repository is located. The structure of an URL for a checkout with SVN and SSH should be like this:
svn+ssh://"Loginname"@"Server-URL(IP)"/"path to the repository" i.e.
If you want you can change the Checkout directory (directory where the Repository will be placed) and after that we just click on ok and the Repository will be downloaded.