Using svnX via svn-ssh

Feb 5, 2007

This is a relatively simple thing to do, and it’s really all about setting up shh rather than svn, but when you don’t quite understand what is happening it’s a little creepy having the authentication handled automatically. The shh authentication process uses a public / private key system which is explained nicely here.

To start you need ssh to use keys rather than passwords. This is because subversion needs to “transparently” authenticate each time you make a request. I hope I’m right in thinking that it opens a tunnel to the remote machine and invokes the service as a svnserve process there.

So, open a terminal window and type ssh-keygen -d to generate your public and private ssh keys. Hit return at each prompt to stick with the default options. You’ll end up with two files called id_dsa.pub and id_dsa in your pwd move the files to ~/.ssh/. Then you need to copy the contents of id_dsa.pub to this file ~/.ssh/authorized_keys on your remote machine ( the one hosting the subversion repository) - creating it if it doesn’t exist. You can append more than one public key to the authorized_keys file if you’re connecting from more than one machine. If you have access to more than one user account on the the remote machine then you need to copy the key into each users authorized_keys file. I used CyberDuck along with a sftp connection to get the onto the remote machine. You should then be able to login to the remote machine using username@server.org. Once you’ve got the ssh connection verified it should be plain sailing with svnx. You’ll be able ot use your repository with the following svn+ssh://username@domain.com/path/to/repository I’ve just found this on the TextMate blog. It’s covering the same ssh key generation process, but using the command line completely, and describing how to set up ssh aliases to save a little bit of typing.