我正在使用 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 配置中http.receivepack
启用了( ):= true
[http]
receivepack = true
有什么想法我应该做什么吗?
答案1
好吧,既然那是在 :8000 的虚拟主机中,我猜你会想要 curl http:// localhost:8000/,而不是 http:// localhost/。除此之外,只需确保 mod_cgi 已启用。