I am using SVN+SSH to check out a working copy of repository from an SVN server on which all developers are members of a developer
group and have full read/write permissions on the repository directory and associated metadata:
svn co svn+ssh://someuser@svn.server/path/to/repository
Several developers work on the same working copy that is checked out under a shared shell account (root
). Because this repository is being used for configuration revision control in a production environment, this is unavoidable. Giving each developer an individual shell account on the target machine (the one on which the checkout is being done) would be one way to solve this problem because then they could each have their own working copy, but unfortunately this is not acceptable here.
We have various post-commit hooks that send e-mails detailing commits, including the username of the person that committed the change.
The problem is that once a working copy is checked out with a given username using the svn+ssh://
URI scheme, commits and updates seem to also have to be done under that username. This is not viable for two reasons:
1) The person who originally made the checkout may not be the person making a commit now, and we need the post-commit e-mails and other post-commit hooks to know exactly who made the commit, and
2) clearly, a commit requires that the committing user know the password of the account of the person who made the original checkout, the use of RSA keys for non-interactive authentication notwithstanding for reason #1.
Is there a way to do dynamically switch out the username of the remote account that is being used for authentication in this scenario?
I did some research and found this question previously:
Changing the username for a Subversion commit over svn+ssh
Unfortunately, the suggestion in the accepted answer (svn switch
) does not work:
[root@db repo-directory]# svn switch svn+ssh://user2@10.250.10.1/u/svc/repositories/repo-name
user2@10.250.10.1's password:
svn: 'svn+ssh://user1@10.250.10.1/u/svc/repositories/repo-name' is not the same
repository as 'svn+ssh://user2@10.250.10.1/u/svc/repositories/repo-name'
Any ideas would be greatly appreciated. Thank you in advance for your consideration!
Ah, well, never mind. It seems that
svn switch --relocate
does the trick:It's cumbersome, though. If there's any easier way, I'm open to suggestions.
Obviously, one can write a
bash
alias or shell-script to automate this part, I suppose, but I wish it were simpler than that.It works with ssh+svn if you modify your client's config: $HOME/.subversion/config tunnels section:
You could do a simple update with another username, too.