Skip to content
November 25, 2011 / Tom

SSH+SVN note to myself!

So, using SSH+SVN on a private repo is one of those console/system nightmares where everyone knows better than you, but still there’s not one piece of working reference.

After the second time of going through that hell, here’s a note to a future me… or anyone that has to go through it:

  • First, you login to your server via telnet. That was one of the things noone said to me:

telnet youruser@yourhost -p port (You don’t specify the port in the address or it won’t work)

  • Then you want to create a public+private key pair on the server; go to ~ (home dir) and run

ssh-keygen -b 1024 -t dsa -f mykey (will create mykey and mkey.pub files)

  • Now create a “.ssh” folder in the home dir, then move and rename mykey.pub to be “.ssh/authorized_keys” (if the file doesn’t exist; otherwise add mykey.pub to its contents)
  • Then download “mykey” to your very computer – it is easy, and obviously is a wall for anyone not already knowing:

rsync [--port nonstandardport] user@host/mykey localpath/mykey

particularly awesome is the –port option, that is deep down in the man page and apparently nowhere to be found on google. Also if you dare to use the standard :port format, it will say random things.

  • now that you have your key safely on your disk, run

chmod 600 mykey (the next step won’t run otherwise)
ssh-add mykey (enter the passphrase)

And you think you are good to go? If you use a non standard port, WRONG.

  • fact is, that ssh does not like at all nonstandard ports. So you have to go and edit your local ~/.ssh/config file to add:

Host yourdomain
User yourusername
Port yourdamnport

  • and then, you can specify your command without the port like this

svn checkout svn+ssh://user@host/yourpath

And this should be all… until it forgets about the whole thing and you must run it again! 🙂

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: