Subversion access via svn+ssh:// on Windows

You'll find this article useful if your Subversion client returns the following error:

svn: Can't create tunnel: The system cannot find the path specified.

This is caused by your Windows SVN client not being configured to use an SSH client when you run commands like svn co svn+ssh://svn.example.com/my/project/.

Solution

First off, if you can, consider Git instead of Subversion. To start with, Git is way faster, the repository is smaller and it doesn't pollute each directory in your tree with a .svn subfolder, branching is instantaneous, and you're ready to connect to GitHub, where all the coolest open source projects are moving to.

Anyway, when I have to use SVN on Windows, I use a light and fast Subversion command line client called Slik SVN. It uses the same configuration directory as other SVN clients like TortoiseSVN:

c:\Documents and Settings\%USERNAME%\Application Data\Subversion\  -- on Windows XP
C:\Users\%USERNAME%AppData\Roaming\Subversion  -- on Vista

In that directory, edit the config file and change the #ssh line in the [tunnels] section to match the path where you have an ssh.exe:

ssh = $SVN_SSH c:/Program Files/Git/bin/ssh.exe

I tried getting plink (an SSH client that comes with PuTTY) to work with Slik SVN, but it hanged and died with a svn: Connection closed unexpectedly error when I pressed Ctrl+C. Besides that, if you're accessing a host for the first time, plink will prompt you to add the host key to its key registry. But, you won't be able to type 'y' at that prompt (the workaround is to connect with plink directly to svn.example.com beforehand, and add its key).

So just install msysgit for Windows, which comes with ssh.exe. Now your initial command should work:

svn co svn+ssh://svn.example.com/my/project/

If you would like to not have to type your password every time you connect via SSH, you can use a key pair and pass the path to the private keyfile to ssh.exe:

ssh = $SVN_SSH c:/Program Files/Git/bin/ssh.exe -i <S:/ssh_keys/servername_private_key.OpenSSH>

Conclusion

Use git if you can, but if you have to use Subversion, it's possible.

Thanks!

Buy me a coffee to sponsor more cool posts like this!

My tags:
 
Popular tags: