home ‣ Using a different username with svn+ssh

03 Apr 2008 · Tags: unix, ssh, svn ← newer • 69 of 588older →

By default ssh uses $USER when connecting to a server which makes things difficult if you use svn with ssh authentication and your username for svn server is different than $USER. To get around this problem, you can setup per host SSH settings. To do this, open ~/.ssh/config and at the end add the lines:

Host svn.yourserver.com
User jdoe

This makes it so that every time I connect to svn.yourserver.com with SSH, it will automatically use the username jdoe instead of my unix username. If you are prompted for a private key password This will look something like:

Enter passphrase for key '/home/jdoe/.ssh/id_dsa':

To get around this you can either setup ssh-agent to cache this password or you can simply turn off the password on your private key. To do the latter, simply type:

ssh-keygen -t dsa -p

and follow the prompts, and when it prompts for a new passphrase, simply hit enter.

blog comments powered by Disqus