HowTo: svn+ssh on Windows

The problem: Windows doesn't have an inbuilt SSH client, so trying to check out files from a Subversion repository over SSH doesn't work out of the box. I've just spend half an hour looking for a way round this, and here it is [as ever, you follow my advice at your own risk]:

  1. I couldn't manage to get it working using PuTTY. Please leave a comment if you have.
  2. Install Cygwin, making sure to include the openssh package
  3. Edit the C:Documents and Settings(yourusername)Application DataSubversionconfig file to include a line reading
    ssh = c:/(cygwin root path)/bin/ssh.exe -i "C:/privatekeypath"
  4. You can omit the -i option and the bit after it if you don't have SSH key authentication set up. If you're using it, though, make sure you use forward slashes in the path to the key file. Note that the private key needs to be in OpenSSH compatible format. If you have key authentication set up in PuTTY, you can export your private key to an OpenSSH compatible version using PuTTYgen.
  5. You should now be able to check out repositories in the usual way from a command prompt:
    svn co svn+ssh://[email protected]/path/to/repository/ destination-dir

    If you exported your PuTTY key as described above, you shouldn't be prompted for your password on hosts where the corresponding public key is in place.


Since writing this post, I've had Tortoise SVN recommended to me, and it Just Works out of the box if you use the PuTTY saved session name in the URL, i.e. if the PuTTY session is called "mybox", svn+ssh://mybox/path/to/repo seems to work correctly.