Using SVN on Windows with public keys.

This describes how to set up Subversion on a Windows machine that does not have OpenSSH installed, to work with SVN repositories that use SSH access.

It needs three packages to be installed:

  1. Install all three tools.

  2. Start puttygen, and generate a key. The default of a SSH-2 RSA 1024 bit key is probably fine, but don't go for a shorter key.

    Set the comment to identify yourself and the machine you're using. You will use a separate key on each machine.

    Attach a passphrase to the key by entering it and confirming. This passphrase needs to be remembered, but will only need to be entered once per system reboot, so a long one is a good idea.

    Save the private key (as a .ppk file) somewhere that you can remember. This is an important file, so don't put it somewhere where it might be accidentally deleted. You'll only need to type the name of the file once during setup in the step below. Name it something like xxxPrivate.ppk, where xxx are your initials. Also save the public key, named xxxPublic.ppk, and send it to the admin of the SVN server.

    Optionally you can copy the OpenSSH public key (which will look something like this:

    ssh-rsa AAAAB3NzaC1yc2EAAAA...

    from the top pane of the window, and send it to the admin of the SVN server. The admin of the server could produce it from the xxxPublic.ppk file using

    ssh-keygen -i

    but sending the converted version will save them a little bit of work.

  3. Start pageant using

    pageant xxxPrivate.ppk

    This will ask you for your private password. Once loaded, you won't need to enter a password again, so at this point don't let unknown individuals use your computer. (You can unload the key using the Pageant agent, started from the icon in the notification area of the Windows taskbar.)

    You can create a shortcut to pageant that does this command, and just click on the shortcut to load your password in the future.

  4. Configure SlikSVN to use tortoisePlink.exe for connections. This is done by finding the application data folder in the user profile directory, and in Roaming/Subversion there's a file called config. One of the lines there (usually commented out) in the [tunnels] section will be “ssh = …”. Remove the comment, and set it to

    ssh = [path to]/tortoisePlink.exe

    (where [path to] is likely something like c:/Program Files/TortoiseSVN/bin).

That's it!

This document was written in January, 2014, for Windows 7, TortoiseSVN 1.8.4, SlikSVN 1.8.5, PuTTY 0.63.

See also this document for administrators of SVN repositories that describes how to give others SSH access to the repository and nothing else.