How to configure SVN/SSH with SSH on non standard port?

You can define a new 'tunnel' in your Subversion configuration (~/.subversion/config). Find the section [tunnels] there and define something like:

[tunnels]
foo = ssh -p 20000

Afterwards you can contact your repository via the URL svn+foo://server.com/home/svn/proj1 proj1.


Whenever you need to access an ssh server on a non-default port or with a different user name, you can define an alias in ~/.ssh/config.

Host mysvn
HostName server.com
Port 20000
User jm

Then run svn co svn+ssh://mysvn/home/svn/proj1.


If for some reason you could not edit the ~/.subversion/config file, then you can specify the port in the command-line:

svn co svn+ssh://joe@myserver/myrepo/ --config-option="config:tunnels:ssh=ssh -p 20000"

but you must do this option every time you run the svn command. This might make sense for a build agent.