Apache-2.2

Apache 沒有呼叫 Smart HTTP CGI

  • July 31, 2012

我正在使用 git-http-backend 和 Smart HTTP 設置 git 伺服器,但 Apache 似乎沒有呼叫 Smart HTTP CGI:

$ curl http://localhost/repo/myproject.git/info/refs?service=git-receive-pack
2ddf56592a0f55456b8c42dc9f2cb9289f083f53        refs/heads/1.0.x
55079bb13d9af8a9164ad0d24b654cbfe119bc7e        refs/heads/master

這是我的配置:

<VirtualHost *:8000>
 ServerName localhost
 DocumentRoot /opt/local/apache2/htdocs/repo

 SetEnv GIT_PROJECT_ROOT /opt/local/apache2/htdocs/repo
 SetEnv GIT_HTTP_EXPORT_ALL

 ScriptAlias /repo/ /usr/libexec/git-core/git-http-backend/
 AliasMatch ^/repo/(.*/objects/[0-9a-f]{2}/[0-9a-f]{38})$          /opt/local/apache2/htdocs/repo/$1
 AliasMatch ^/repo/(.*/objects/pack/pack-[0-9a-f]{40}.(pack|idx))$ /opt/local/apache2/htdocs/repo/$1

 ScriptAliasMatch \
   "(?x)^/repo/(.*/(HEAD | \
   info/refs | \
   objects/(info/[^/]+ | \
       [0-9a-f]{2}/[0-9a-f]{38} | \
       pack/pack-[0-9a-f]{40}\.(pack|idx)) | \
   git-(upload|receive)-pack))$" \
   /usr/libexec/git-core/git-http-backend/$1

 <Directory "/usr/libexec/git-core/">
   Options +ExecCGI
   Allow From All
 </Directory>

 <LocationMatch "^/repo/.*/git-receive-pack$">
   AuthType Basic
   AuthName "Git"
   Require valid-user
   AuthUserFile /etc/apache2/other/htpasswd
 </LocationMatch>
</VirtualHost>

這是輸出httpd -S

VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:8000                 localhost (/private/etc/apache2/other/gitrepo.conf:1)
Syntax OK

我已經在我的伺服器端 git config 中http.receivepack啟用( ):= true

[http]
 receivepack = true

關於我應該做什麼的任何想法?

好吧,因為那是在虛擬主機中:8000,我想你想 curl http://localhost:8000/,而不是 http://localhost/。除此之外,只需確保 mod_cgi 已啟用。

引用自:https://serverfault.com/questions/412314