如何将 LDAP 用户作为 commiter/author 名称提交到 GIT 存储库?

How can I commit to GIT repos with the LDAP user as the commiter/author name?

我已经使用 LDAP 身份验证设置了我的 git 存储库。一切正常,除了 Git 允许在提交时将任何内容作为提交者或作者姓名这一事实。我需要 Git 将 LDAP 身份验证用户作为提交者和作者命名。我不想让我团队里的任何人放他们想放的东西。

目前我们正在尝试 Egit(Eclipse 插件),它需要作者和提交者字段。但我仍然看到提交命令也允许将任何东西放在那里。所以它似乎是一个 Git 功能。跟分布式有关系吗?

在我读到的有关使用 LDAP 进行身份验证的问题中,似乎没有人对此感到困扰。起初我认为我为此进行的手动 Apache 设置(在此处找到 Q 和 A 之后)是问题所在,但是使用 Gitblig 大量利用此设置,它是相同的。

所以问题是:我可以使用 LDAP 用户作为 commiter/author 名称提交 GIT 回购吗?

It still amazes me how this behavior of git seems ok, given the fact that I could even course on the author name and no one would be able to identify who really committed.

这是分布式系统的自然结果:用户无法访问集中式身份验证服务器,因此作者使用 "marker"(表示 his/her 用户名的字符串)和提交者。

在我的公司,使用 gitolite,我放置了一个脚本来检查至少所有推送的提交都是由 LDAP 验证的用户提交的。

gitolite knows the user as $GL_USER, and I check each commits.

这显然不是一个通用的解决方案,因为它会阻止用户推送任何重新定位的提交,其中包括来自其他人的提交。但在我的特定设置中,此工作流程有效。

更通用的解决方案仍然是 signing the commits

git commit -a -S -m 'signed commit'

从 git 2.6 开始,检查签名提交的自动化(使用 git verify-commit) will be easier: see "Verifying signed git commits?"