我的设置是:
1. 用于 Git 存储的 OS X 运行 apache 服务器。
2. 我的 Git 项目目录在这里:/Library/WebServer/Documents/CI
3. 我遵循了这个教程:http ://www.pkgbox.org/wordpress/2011/08/setting-up-a-git -server-on-macos-x-lion/并通过 HTTP
4 设置 Git 访问。我的 gitrepo.conf 如下:
DavLockDB "/var/www/DavLock/Lock"
DavMinTimeout 28800
<Directory /Library/WebServer/Documents/CI>
DAV On
Deny from all
AuthType Basic
AuthName "Area51 git repositories"
AuthUserFile /etc/apache2/other/htpasswd-git
AuthGroupFile /etc/apache2/other/htgroup-git
</Directory>
<Directory /Library/WebServer/Documents/CI/ci_test.git>
Allow from all
Order allow,deny
Require valid-user
<Limit GET>
Require group myproject-reader
</Limit>
<Limit GET PUT POST DELETE PROPPATCH MKCOL COPY MOVE LOCK UNLOCK>
Require group myproject-writer
</Limit>
</Directory>
5. HTTP 身份验证工作正常,我有不同的用户和不同的组,一切正常。
我的问题是: 我希望能够在我的 git 中使用 post-receive 钩子。我读过这个问题:Git post-receive hook not working 而我从那里得到的是我需要设置 SMART HTTP。不幸的是,这个链接: http ://www.kernel.org/pub/software/scm/git/docs/git-http-backend.html get's me 404。
我在这里读过:http: //progit.org/2010/03/04/smart-http.html但我真的是设置服务器的新手,我不明白我应该做什么......你能为我提供激活 GIT 钩子的有效配置吗?
建议的解决方案 更改为 SMART HTTP。
这是我当前的 gitrepo.conf
<VirtualHost *:80>
ServerName ciserver.smt
DocumentRoot /Library/WebServer/Documents/CI
SetEnv GIT_PROJECT_ROOT /Library/WebServer/Documents/CI
SetEnv GIT_HTTP_EXPORT_ALL
ScriptAlias / /usr/libexec/git-core/git-http-backend/
AliasMatch ^/(.*/objects/[0-9a-f]{2}/[0-9a-f]{38})$ /Library/WebServer/Documents/CI/$1
AliasMatch ^/(.*/objects/pack/pack-[0-9a-f]{40}.(pack|idx))$ /Library/WebServer/Documents/CI/$1
ScriptAliasMatch \
"(?x)^/(.*/(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
<LocationMatch "^/.*/git-receive-pack$">
AuthType Basic
AuthName "Git"
AuthUserFile /etc/apache2/other/htpasswd-git
AuthGroupFile /etc/apache2/other/htgroup-git
<Limit GET>
Require group myproject-reader
</Limit>
<Limit GET PUT POST DELETE PROPPATCH MKCOL COPY MOVE LOCK UNLOCK>
Require group myproject-writer
</Limit>
</LocationMatch>
</VirtualHost>
我已更改 /etc/hosts 以将 ciserver.smt 添加为指向 127.0.0.1 现在我无法发出此请求:
git clone http://username@ciserver.smt/ci_test.git
我越来越:
error: The requested URL returned error: 403 while accessing http://username@ciserver.smt/ci_test.git/info/refs
fatal: HTTP request failed
我还是做错了什么?