6

One thing that is important with version control is knowing who made what change. If something was changed and I had no idea why the change was made, I would look in the history and ask the person who made the change. As I am exploring git, one thing that makes me a little nervous about this feature is that it seems really easy to fake. What is stopping me from putting a co-workers name/email in the git global config for user.name and user.email? When using something like gitosis/gitolite (which defined users) or github (which I assume using something like gitosis/gitolite), is there any wyy to see who truly made a commit?

4

3 回答 3

5

Gitolite 记录(in .gitolite/logs/gitolite-*)每次推送的 Gitolite 用户。确定引入特定提交的推送还有一些工作要做,但它应该是直截了当的(一种方法:在每次推送的尖端放置轻量级标签,然后用于git name-rev在提交后查找第一个标签)。

大多数 Gitolite 用户可能只有一个与他们关联的 SSH 密钥 ( keydir/user.pub),但单个用户可能拥有多个 SSH 密钥 ( keydir/user@*.pub)。

因此,对于基于 SSH 的 Gitolite,您可以将每个提交映射到一个(或多个)SSH 密钥。

您是否信任 SSH 密钥来准确识别特定的人是另一个问题(即您是否信任用户来保证他们的私有 SSH 密钥的安全?)。

Gitolite 还可以通过“智能 HTTP”调节 Git 访问。在这种情况下,Web 服务器在 REMOTE_USER 环境变量中提供 Gitolite 用户名(即,而不是使用该.ssh/authorized_keys文件根据 SSH 密钥来识别用户)。识别和身份验证完全取决于 Web 服务器本身(通常只是用户名和密码,但每个用户的 SSL 证书可用于执行更像基于 SSH 的访问)。

因此,对于基于 HTTP 的 Gitolite,您可以将每个提交映射到 Web 服务器完成的身份验证。


GitHub 有一些类似的信息,可以通过GitHub API的事件部分进行查询(以前,它似乎仅作为您关注的存储库的“新闻源”条目的一部分提供)。每个PushEvent标识执行推送的 GitHub 用户、更新了 ref(分支)的名称、新 ref “head”(更新分支的新提示)的名称(SHA1 哈希)以及提交列表.

于 2011-04-23T11:33:49.297 回答
1

这不是伦理或哲学论坛,afaik;

git 允许签名提交和签名标签。这应该可以帮助您满足偏执狂:)

于 2011-04-23T11:36:24.703 回答
0

您可以让每个人都使用 GPG 签署提交:请参阅本教程

在本教程中,GPG 密码是在 git config 中设置的,这对我来说似乎是无稽之谈,因此您需要让钩子在每次提交时提示用户。

当然,如果你不是经理,建议每个人都签署他们的承诺在外交上可能会很艰难,所以要谨慎。

编辑:正如布赖恩指出的那样,这只会签署提交消息,所以这不是好的解决方案。我保留答案,因为它可能仍然有助于理解问题。

于 2011-04-22T13:22:57.817 回答