在工作副本中即时更改 SVN+SSH URI 中的用户名 [英] Changing username in SVN+SSH URI on the fly in working copy

查看:59
本文介绍了在工作副本中即时更改 SVN+SSH URI 中的用户名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 SVN+SSH 从 SVN 服务器检出存储库的工作副本,在该服务器上所有开发人员都是 developer 组的成员,并且对存储库目录具有完全读/写权限,并且相关元数据:

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

几个开发人员在同一个工作副本上工作,该副本在共享 shell 帐户 (root) 下签出.由于此存储库用于生产环境中的配置修订控制,因此这是不可避免的.在目标机器上给每个开发人员一个单独的 shell 帐户(正在完成结帐的机器)将是解决这个问题的一种方法,因为这样他们每个人都可以拥有自己的工作副本,但不幸的是,这在这里是不可接受的.

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.

问题在于,一旦使用 svn+ssh:// URI 方案使用给定的用户名签出工作副本,提交和更新似乎也必须在该用户名下完成.这是不可行的,原因有两个:

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) 最初进行结帐的人可能不是现在进行提交的人,我们需要提交后的电子邮件和其他提交后的钩子来确切地知道是谁进行了提交,以及

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) 显然,提交要求提交用户知道进行原始结帐的人的帐户密码,尽管出于 #1 的原因,仍使用 RSA 密钥进行非交互式身份验证.

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:

通过 svn+ssh 更改 Subversion 提交的用户名

不幸的是,接受的答案(svn switch)中的建议不起作用:

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!

推荐答案

嗯,没关系.似乎 svn switch --relocate 可以解决问题:

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.

显然,我想可以编写一个 bash 别名或 shell 脚本来自动化这部分,但我希望它比这更简单.

Obviously, one can write a bash alias or shell-script to automate this part, I suppose, but I wish it were simpler than that.

这篇关于在工作副本中即时更改 SVN+SSH URI 中的用户名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆