SVN: How to commit as a different user

23 09 2009

Today I spend some time to find out how to commit as a different user in SVN.

I did a checkout using svn+ssh by specifying username in the url for example svn+ssh://<username>@server/path/to/repos . The code was checkouted by user1, and this code can be accessed by user2. user2 edited some files and want to commit as user2. Every time when user2 is trying to commit, it is always asking the user1 password.

Actually if we use http or svn protocol, we can use –username attribute in the svn commit but this did not work for svn+ssh.

I tried by using –username, –no-auth-cache parameters in the svn commit but it does not work, always asking the user1 password.

After some time googleing, I went to svn IRC channel and asked there. Finally I am able to solve the problem by seeing the thread

1. We should change the svn root url to svn+ssh://server/path/to/repos. To change this I used svn switch command. I used following command.

svn --relocate switch svn+ssh://user1@server/path/to/repos svn+ssh://server/path/to/repo

2. Edit /home/user2/.subversion/config. Change the line that reads
#ssh = $SVN_SSH ssh to:

ssh = $SVN_SSH ssh -l <username>

<username> can be any user on the remote machine, but in my case it was user2.

That’s it from now on when I do commit it is asking user2 password.

The second step is not required if logged in username is same as svn+ssh username that you want to use. Suppose if you login to system as user2 and your svn server ssh username is also user2, then you can skip the 2nd step. It will ask user2 password when you try to commit.




2 responses

3 10 2009

Are you still using Bazaar or you shifted to svn ? And if it’s the case I will be interested in knowing the reasons …. 😉

3 10 2009

hmm, presently i am not using Bazaar. I don’t say I shifted to svn. I still want to use Bazaar. I am using svn just because told me use only this. I think you can understand :).

Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s

%d bloggers like this: