AA Design

Two boyz and a fancy website

Setting up an SVN repository on your host, using an SSH tunnel for comunication

After half a day of googling, reading tutorials, man pages, references, source code files, configuring my router, running shell commands, installing software on both ends, modifying various plain text config files, writing shell scripts, and usually having between 3 and 5 terminal windows open at all times, plus 7 to 10 tabs open in my browser, I finally managed to get an svn repository working to sync files between my development machine and the live server, without touching ftp!

Of course, one day I’m going to need to repeat all of the above, so I’m writing it down here. Fortunately for anyone wishing to repeat the task, most of the stuff I did wasn’t necessary in the end. Here’s what you need to do:

Step 1: Install svn on the client machine and the server. I used fink and FinkCommander to install the svn package on my mac (this is an easier way), and your host will probably need to do the installing on his end.

Step 2: Get host to enable ssh access on the server, my host is run by a mate of mine, so this was pretty easy. Your milage may vary.

Step 3: Configure ssh to use a non-standard port when connecting to the server. For security reasons, my host doesn’t use the default port 22 for ssh, so we need to tell ssh what port to use when connecting to this host. For that you need to add the following code to the end of ~/.ssh/config:

Host myhost.com
Port ###

As instructed in the man page for ssh_config.

Step 4: Unless you enjoy entering your password several times for each action you perform, you’ll need to set up rsa public key authentication for your account. This basically involves generating a public/private key, then copying the pubic key into a specific location on the server. I followed this tutorial to achieve that, however they rely on a the ssh-copy-id command, which doesn’t exist under MacOS X, so I had to modify this script to complete that section (note: that script doesn’t work out of the box with rsa authentication, It has to be slightly modified).

Step 4: Follow instructions in this if you don’t know how to use svn. When they talk about file or http url’s, you need to use this format instead “svn+ssh://username@hostname/home/username/repository/path”.

Step 5: There isn’t a step 5… Wow! A whole day to figure out 4 simple steps… reminds me why I’m glad I don’t have to deal with linux every day.

1 Comment so far

  1. Ben Perry June 27th, 2006 12:48 pm Répondre à ce commentaire

    Very cool. Nice work

Leave a reply