After mentioning that I was using svnserve, a friend sent me a twitter message asking why I wasn’t using svn+ssh, so I thought I’d have a look. It turned out to be really simple to make the move, and I’m left with a nicer setup than before.
Firstly, let’s kill the running svnserve process as we’re not going to be using that anymore.
[user@server ~]$ ps aux | grep svn
user 2495 0.0 0.3 45856 940 ? Ss 20:02 0:00 svnserve -d -r repository/
user 2501 0.0 0.2 3936 724 pts/0 S+ 20:02 0:00 grep svn
[user@server ~]$ kill 2495
If you’ve specifically opened port 3690 (which is the default svnserve port) in your firewall you should close that again now. You can check your current firewall ruleset using the list flag.
[user@server ~]$ iptables --list
I happen to run ssh on a non-standard port, so to save myself having to specify this each time I’ve overridden the default tunnel subversion has setup for ssh. This stage is run on your local machine (or where you want to check out your repository).
local:~ cameron$ nano -w .subversion/config
Under the [tunnels] section, I added the following line. Note that XXXX is where my non-standard port is specified, and REMOTEUSERNAME is the username I’m using to connect to the server to checkout my repository. The -C flag enables compression, and seems to greatly speed things up.
ssh = /usr/bin/ssh -p XXXX -l REMOTEUSERNAME -C
Okay, so let’s try and check something out! I’m hoping you have ssh keys configured already, but if not here’s an SSH Keys Howto. Note you have to specify absolute paths now.
local:~ cameron$ svn co svn+ssh://yoururl/path/to/repository/trunk
A trunk/wp-config.php
A trunk/wp-pass.php
A trunk/wp-rss.php
…
With any luck, that’ll checkout your repository.
If you already have a repository checked out and don’t want to delete it and checkout again, there’s a solution for you too. Change into your local working copy and run the following;
local:projects cameron$ svn switch --relocate svn://yoururl/repository/trunk svn+ssh://yoururl/path/to/repository/trunk