arch detail

arch detail

Monday, August 28, 2006

HOWTO: Subversion over SSH with different usernames

I was recently faced with the problem of needing to check out a Subversion repository on a machine where I had one username onto a machine where I had another.

This was deceptively difficult.

The problem is, svn checkout has a --username ARG option, but that only applies to Subversion. We use svn+ssh:// for security.

I tried the obvious things - svn+ssh://[user]@[host], etc - but nothing worked. After butting my head for a while, I decided to actually read up on how to do this.

Well, Subversion will let you define your own tunnelling protocol if you define the programs which they use. The trick is this: In your ~/.subversion/config, create an entry along these lines:

dummyssh = dummyssh

Then create a BASH script somewhere in your path called dummyssh and make it executable. The script should basically be this:

#!/bin/bash
ssh -l [your username] $*

Now you just do

svn checkout --username svn+dummyssh://[host]

And you can pull it off.

I have to admit, I wish the Subversion manual included this information. Hope somebody finds it useful.

4 comments:

Peter said...

Not sure why it didn't work for you, but in situations where I had to checkout using a different username, I merely specified it as "svn co svn+ssh://user@host/path/to/svn/repo" and it worked flawlessly.

Peter

Peter said...

Correction:

"svn co svn+ssh://user@host:/path/to/svn/repo"

Peter

Pierre said...

Thanks, this is the only site I found such information. Very helpful.

Unknown said...

It must be

[tunnels]
dummyssh = dummyssh

in the svn config file.