arch detail

arch detail
Showing posts with label ssh. Show all posts
Showing posts with label ssh. Show all posts

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.