svn over ssh prompts for the wrong username
It is time again for one of these rather low level bits :)
The company I am currently working for uses subversion as version control system. The server is setup to use svn+ssh protocol only. Initially I tried to access the source code like this:
svn --username hardy.ferentschik checkout svn+ssh://servername/projectname/trunk
For some reason svn would then always prompt me for a password for
hardy@servername
, where hardy is my user name on the local machine. I couldn't really figure out what was going on. It seemed that the user name specified via --username was not getting passed to the ssh client. I then tried:
svn checkout svn+ssh://hardy.ferentschik@servername/projectname/trunk
which worked fine. I completely forgot about this problem for a while. Until yesterday that is. I wanted to configure a svn:external link from one project to another in order to be able to check them out into the same directory. svn:external works similar to cvs ampersand modules and can be a very useful feature.
For the svn:external property I couldn't use the url with my username in it, since then everyone checking out the project would have to authenticate with my credentials. Not really a solution. I had to use svn+ssh://servername/projectname/trunk. But now of course my problem re-appeared.
First I tried to find a solution in the svn documentation and on the svn forums, but there is really only the --username option. I was already close to giving up when I thought that if I just could tell ssh which user to use. That was the right path and after a little more search I found out about the config file in the .ssh directory. I've never used it before so I did not even know that it existed. Anyway, the simple solution to my problem was to create a config file in my .ssh directory and putting the following in:
Host servername
User hardy.ferentschik
That fixed the problem :) I still would claim that there must be a bug in the svn client implementation when using --username together with svn+ssh. Surely it should pass the user name on to ssh.
I hope this might help someone with similar problems.
Cheers,
Hardy
Thanks once again!!
Niraj