1

在像我希望的那样使用 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>
4

1 回答 1

1

由于 [PT] 还需要 [L] 没有执行任何低于它的规则,移动上面的 AUTHREQUIRED 规则解决了这个问题。

于 2013-02-28T14:56:22.613 回答