有什么方法可以确保git用户在提交和推送时不使用假帐户信息? [英] Any way to guarantee that a git user doesn't use fake account info when commiting and pushing?
问题描述
由于git用户可以自由配置他们的user.name和user.email并进行提交,因此John可能会使用Bob的名字和电子邮件来伪造一个提交,这不是我们想要的.有什么办法可以防止这种情况?我知道在svn中,我们需要用户名和密码来提交;Git中有任何等效的机制吗?
Since git users can config their user.name and user.email freely and do commits, it's possible for John to fake a commit with Bob's name and email, which is not what we want. Is there any way to prevent this? I know in svn we need username and password to commit; is there any equivalent mechanism in Git?
推荐答案
一些复杂的解决方案是可能的,我想:
Some convoluted solutions are possible, I guess:
- 需要SSH帐户才能访问存储库;为每个授权用户创建一个存储库.
- 在每个存储库中创建钩子,以重写推送的提交,以包括该存储库所属"的作者的信息.
- 重写后,将所有内容推送到主存储库中.
此解决方案不仅使人痛苦不堪,而且易于重写和误称作者从同事或其他人那里得到的其他人的提交.
This solution is not only a pain in the ass but also prone to rewrite and mis-attribute commits from other persons that the author included from a co-worker or somebody else.
gitosis
或 gitolite
可能也提供类似的功能,我也不知道,我从未使用过它们.
gitosis
or gitolite
might offer some functionality like that, too, I don’t know, I’ve never used them.
就个人而言,我只是不希望与会严重损害提交内容的作者信息的人一起工作.
Personally, I would simply prefer not to work with people who would seriously hamper with a commit’s author information.
这篇关于有什么方法可以确保git用户在提交和推送时不使用假帐户信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!