Changing Port Number of svn+ssh Subversion Protocol
Most times, when we access subversion through the svn+ssh:// protocol, we are satisfied with the default behaviour, which is simply spawning ssh behind the scenes, and have it connect using the default port 22 of the ssh protocol.
But, sometimes this is not enough. In my previous post I just described how ssh is great for tunneling and port forwarding. To access a remote subversion server, which was hidden behind a firewall and two hops into the system behind it, I had to port forward a local port all the way to the ssh port 22 of the behind the firewall host. My local ssh port that was tunneled into the remote system ended up on a local port, say 12345.
So, how to tell subversion to spawn ssh with a config of port 12345, when accessing a svn+ssh://-like URL? Well, turned out to be quite easy.
Subversion has a local configuration file .subversion/config, which can be used for various, … hmm, configuration stuff A cool thing is, that one can provide new protocols. So, with this configuration in .subversion/config:
sshtunnel = ssh -p 12345
I can use a subversion URL like this: svn+sshtunnel:// and subversion will spawn the given command with the port option.
Great tool – subversion.