成功地按照我希望的方式使用GIT进行重写工作后,我设法破坏了需要推送到git的身份验证。
出于某种原因,如果请求ScriptAlias
,则http://username:password@domain.tld/
的重写似乎会丢弃身份验证信息,从而无法推送数据。
<VirtualHost *:80>
DocumentRoot /home/subgit/repos
<Directory /home/subgit/repos>
Options None
AllowOverride none
Order allow,deny
Allow from all
</Directory>
CustomLog /home/subgit/logs/access_log combined
SuexecUserGroup subgit subgit
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} ^git
RewriteRule ^(.*)$ /git/testrepo/$1 [PT]
RewriteCond %{QUERY_STRING} service=git-receive-pack [OR,NC]
RewriteCond %{REQUEST_URI} ^/git/.*/git-receive-pack$ [NC]
RewriteRule .* - [E=AUTHREQUIRED:yes]
ScriptAlias /git/ /home/subgit/bin/gitolite-suexec-wrapper.sh/
<LocationMatch "/git/">
Order Allow,Deny
Deny from env=AUTHREQUIRED
Allow from all
Satisfy Any
AuthType Basic
AuthName "subgit"
AuthBasicProvider file
AuthUserFile /home/subgit/etc/subgit
Require valid-user
</LocationMatch>
</VirtualHost>
答案 0 :(得分:1)
由于[PT]也需要[L],因此下面的任何规则都没有被执行,移动上面的AUTHREQUIRED规则解决了这个问题。