English 中文(简体)
Changing username in SVN+SSH URI on the fly in working copy
原标题:

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:

svn switch --relocate svn+ssh://olduser@svn.server/path/to/repo svn+ssh://newuser@svn.server/path/to/repo

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:

ssh = $SVN_SSH ssh -l *youruser*

You could do a simple update with another username, too.

svn update --username <user> --password <pwd>




相关问题
Tracking Versions, Builds, Revisions, with TortiseSVN

I am the sole developer on a project and have been using tortoiseSVN for quite a while. Now Id like to start getting version information working correctly in the project I.E. show Major Version, Minor ...

Tips on upgrading CVS to git/hg?

We still use CVS, I use git and hg for my personal use though I m still a novice at both, but I realize they re much more modern and better, faster, distributed, etc. It s just everyone is so ...

How to handle different csproj [closed]

I am working in a team of five. We are working on a C# application with five csprojects. The problem is that for each csproject, each of my colleagues has their own ideas on how to reference a DLL; ...

Changing username in SVN+SSH URI on the fly in working copy

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 ...

How to search for file in subversion server?

Is there a way to search for a file in a subversion repository? Something similar to Unix find command, with which I can find the location of a file in a repository. I know there is svn list, but ...

热门标签