gitweb和每个项目的http身份验证

时间:2012-12-31 09:20:30

标签: git apache gitweb

我已成功在所有经过身份验证的用户的apache vHost上设置gitweb。

服务器本身通过https提供了几个git存储库,并且每个用户/组都可以访问这些项目。例如,test1.git只能通过组test1读/写,test2.git只能通过组test2读/写。

现在我也希望只有那些组才能在gitweb界面中看到相应的git存储库。是否可以为gitweb提供那些细粒度的访问权限?

如果没有,是否有一个轻量级的web gui for git,可以处理每个项目的基本http身份验证(以及稍后可能的ldap身份验证)?

修改 只是为了让事情更清楚(因为评论似乎有些混淆): 例如:

  • 有10个存储库(test1,test2,... test10)

  • 用户 lockdoc 位于 test1 组和 test3

  • 使用用户名 lockdoc 和他/她的密码通过http进行身份验证后,此用户只能看到git项目 test1 test3 并且无法浏览/查看任何其他项目

  • 无需在网络界面上书写(推送),因为这已经实施了

1 个答案:

答案 0 :(得分:4)

没有GUI,但我建议使用gitolite这种细粒度的authorization

请参阅此httpd.conf for LDAP and gitolite access

  • 你可以定义一个gitweb访问,然后调用gitolite,看看这个gitweb.conf.pl脚本
  • 你可以定义一个https acces,它也会调用gitolite(为了允许或拒绝访问,取决于你的id)

https配置如下所示:

ScriptAlias /hgit/ @H@/sbin/gitolite-shell/
SetEnv GIT_HTTP_BACKEND "@H@/usr/local/apps/git/libexec/git-core/git-http-backend"
<Location /hgit>
   ...
</Location>

在这两种情况下,您都可以使用基于LDAP的身份验证来保护这些http地址:

AuthName "LDAP authentication for ITSVC Smart HTTP Git repositories"
AuthType Basic
AuthBasicProvider myldap companyldap
AuthzLDAPAuthoritative Off
Require valid-user

您将在与gitolite相关联的gitolite.conf configuration file中注册您的用户/群组/回购。

@lockdoc_repos           =   test1 test3 # group of repo

repo @lockdoc_repos
    R                    = lockdoc # read-only access for lockdoc
    R                    = gitweb daemon # can be browsed   

有关如何允许浏览回购的更多信息,请参阅“testing/info/refs not found in gitolite after removing R @all rule”,由{gitolite本人的创建者sitaramSitaram Chamarty)提供。