我正在尝试在我的apache2服务器上设置git-http-backend。 目前它正在使用suexec和一个包装和所有的东西,但没有限制。 我可以拉和推。
现在我想包括部分restrcit推送权限:
<LocationMatch "^/git/.*/git-receive-pack$"> AuthType Basic AuthName "Git Access" AuthUserFile /var/www/vhosts/librepdm.alitecs.de/users Require user alexander </LocationMatch>
用户文件已到位并已填写。 这说我的Apache访问日志:
93.95.132.202 - - [28/Mar/2012:15:23:18 +0200] "GET /git/test.git/info/refs?service=git-receive-pack HTTP/1.1" 403 357 "-" "git/1.7.8.msysgit.0" 93.95.132.202 - - [28/Mar/2012:15:23:18 +0200] "GET /git/test.git/info/refs HTTP/1.1" 200 331 "-" "git/1.7.8.msysgit.0" 93.95.132.202 - - [28/Mar/2012:15:23:18 +0200] "GET /git/test.git/HEAD HTTP/1.1" 200 341 "-" "git/1.7.8.msysgit.0" 93.95.132.202 - - [28/Mar/2012:15:23:22 +0200] "PROPFIND /git/test.git/ HTTP/1.1" 405 536 "-" "git/1.7.8.msysgit.0"
这是我的error_log
[Wed Mar 28 15:23:18 2012] [error] [client 93.95.132.202] Service not enabled: 'receive-pack'
好吧,提示是好的,如果我启用http.recievepack在回购作品,但如果我不告诉在url中的凭据我再次出现错误,我不想激活。 所以我尝试了别的。 我编辑了LocationMatch如下:
<LocationMatch "^/git/.*$"> AuthType Basic AuthName "Git Access" AuthUserFile /var/www/vhosts/librepdm.alitecs.de/users Require user alexander </LocationMatch>
我在正则expression式中删除了“git-recieve-pack”。 惊喜一切现在保护也拉动但是如果我不告诉我的凭据在URL TortoiseGIT要求我的用户和密码和推工作没有设置http.recievepack为true。 apache日志有点不同:
93.95.132.202 - - [28/Mar/2012:15:46:16 +0200] "GET /git/test.git/info/refs?service=git-receive-pack HTTP/1.1" 401 691 "-" "git/1.7.8.msysgit.0" 93.95.132.202 - - [28/Mar/2012:15:46:20 +0200] "GET /git/test.git/info/refs?service=git-receive-pack HTTP/1.1" 401 691 "-" "git/1.7.8.msysgit.0" 93.95.132.202 - alexander [28/Mar/2012:15:46:20 +0200] "GET /git/test.git/info/refs?service=git-receive-pack HTTP/1.1" 200 466 "-" "git/1.7.8.msysgit.0" 93.95.132.202 - alexander [28/Mar/2012:15:46:21 +0200] "POST /git/test.git/git-receive-pack HTTP/1.1" 200 380 "-" "git/1.7.8.msysgit.0"
如果我对第一个接入电话的第一个接入电话是不同的。 在第一部分,它指出403 – 未经授权,但我没有被要求credentails,并没有帮助通过在url。 我第二个说401是好的。
所以我的问题是,为什么login工作,如果我保证整个位置,而不是如果我只想保证推动? 得到的命令是相同的,但不知何故我不要求login。 恕我直言,这不是一个混帐或TortoiseGT或mysysgit,但Apache的问题…
问候,亚历山大
我更新了我的configuration,如下所示:
<Location /public > SetEnv CGIT_CONFIG /srv/git/etc/cgitrc-public SetHandler cgi-script Options +ExecCGI RewriteCond %{QUERY_STRING} service=git-receive-pack RewriteRule .* - [E=AUTHREQUIRED:yes] AuthzLDAPAuthoritative Off AuthLDAPURL "ldap://myldap.mycorp.com/dc=mycorp,dc=com?mailNickname" AuthLDAPBindDN "ldapaccount" AuthLDAPBindPassword password AuthType Basic AuthName "MyCorp LDAP Protected Area" require valid-user
看看请求
/git/test.git/info/refs?service=git-receive-pack
它不匹配<LocationMatch "^/git/.*/git-receive-pack$">因为service=git-receive-pack是参数而不是位置(URI)