Gitosis可以强制执行正确的用户名/电子邮件吗? [英] Can Gitosis enforce correct user name/email?

查看:150
本文介绍了Gitosis可以强制执行正确的用户名/电子邮件吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Gitosis能够基于公钥/私钥对对用户进行身份验证.它能够找出当前正在提交的用户.但是,用户名和电子邮件来自客户端的Git配置('git config user.name'等),可以将其设置为任意值.有什么方法可以将用户名和电子邮件与其公钥相关联,然后让Gitosis使用这些名称和电子邮件作为提交者的名称和电子邮件?

Gitosis is able to authenticate users based on public/private key pair. It is able to find out which user is currently committing. However, the user name and email is taken from the client's Git configuration ('git config user.name' etc.), which can be set to arbitrary values. Is there any way to associate user names and emails with their public keys and then make Gitosis uses these names and emails as the name and email of the committer?

我不在乎是否要使用Gitosis或WebDAV或其他替代方法来共享存储库.在我看来,所有可用方法都不支持使用某种正确"用户名和电子邮件的强制实施.如果有其他选择,请告诉我.

I do not care if I will use Gitosis or WebDAV or some other alternative to share the repository. It just seems to me that none of the available methods supports this enforcement of using some kind of "correct" user name and email. If there exists some alternative, please tell me about it.

推荐答案

示例

The example update-paranoid hook in Git sources does the following check:

对于所有新的提交或标记对象,提交器(或标记器)行 对象中的对象必须与user.committer之一完全匹配 acl文件中列出的值.

For all new commit or tag objects the committer (or tagger) line within the object must exactly match one of the user.committer values listed in the acl file.

我想人们可以配置 Gitosis

I guess that one can configure Gitosis or Gitolite to do similar check, or you can write your own upate or pre-receive hook. In all those cases the push must be done via "smart" transport, one that can use Git. This mean pushing via SSH, or via "smart" HTTP (git-http-backend); it excludes pushing via WebDAV ("dumb" HTTP(S)).

请注意,检查提交的作者身份没有意义,因为它们可能来自通过电子邮件发送的补丁(提交者应在申请之前检查它们),或者来自挑选或重新定基.

Note that it doesn't make sense to check authorship of commits, as they may come from patches send by email (it is committer that should check them before applying), or from cherry-picking or rebasing.

这篇关于Gitosis可以强制执行正确的用户名/电子邮件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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