Using TortoiseSVN with svn+ssh tunnel over non-standard ports

Configuring recent versions of toirtoise SVN to work with non-standard ports is a bit tricky. I tried editing the “subversion config file” through Settings->General->Edit, to using an ssh command line, like the one I’m using on Linux for the same repository, but that didn’t work.

A quick hack-style solution is to go to TortoiseSVN->Settings->Network and set the SSH client to (assuming port number XX): “C:\Program Files\TortoiseSVN\bin\TortoisePlink.exe -P XX” (The hack is also described here: )

The issue with this hack is that if you have multiple repositories, each with different ports, this does not work. A more generic and elegant solultion is to use a batch script that is able to parse correctly an SVN URL of the type svn+ssh:// with the correct port, and use it as a wrapper of your TortoiseSVN ssh agent.

You can find a working script with this solution here:

I’m quoting the batch script here (for redundancy purposes):

@echo off
set HOST=%1
set PORT=%HOST:*:=%

IF [%PORT%]==[%HOST%] (
 set PORT=22
 c:\\Progra~1\\TortoiseSVN\\bin\\TortoisePlink.exe -P %PORT% %HOST% %2 %3