[更新2010年9月16日]管理到Git仓库http访问
寻找这个经过昨晚,我意识到,我原来的问题真的问2件独立的事情:
1 )是否可以为gitosis创建的所有远程存储库设置更新后的挂钩(即,在gitosis中创建存储库后不需要手动执行mv hooks/post-update.sample hooks/post-update
)这对于通过HTTP进行克隆来工作是必需的(愚蠢的HTTP客户端依靠事实上,git update-server-info
是从更新后的挂钩中调用的)。
2)一旦储存库是通过HTTP访问,是能够打开和关闭在gitosis.conf的使用选项(类似的东西,以daemon = no
或gitweb = yes
)
访问---用于解决第1个问题---
事实证明,Git使用模板创建新的存储库与git init
命令。通过在模板目录中执行mv hooks/post-update.sample hooks/post-update
,我的服务器上所有未来呼叫git init
将具有正确配置的更新后挂接。 (在OSX模板目录是/opt/local/share/git-core/templates/
对于那些关心)
对于这项工作的另一个要求是在Apache重写规则转动,这样对资源库中的HTTP克隆URL看起来像http//git.example.com/repo.git
我重写规则/etc/apache2/extra/httpd-vhosts.conf
这个样子的:
# turning on mod rewrite
RewriteEngine on
# make the front page an internal rewrite to the gitweb script
RewriteRule ^/$ /cgi-bin/gitweb.cgi [L,PT]
# make access for "dumb clients" work
RewriteRule ^/(.*\.git/(?!/?(HEAD|info|objects|refs)).*)?$ /cgi-bin/gitweb.cgi%{REQUEST_URI} [L,PT]
---还在寻找一个解决问题2 ...帮助! :) ---
既然HTTP克隆适用于我所有的仓库,我想知道是否有一种方法来管理使用gitosis的HTTP访问控制。设置daemon = no
和gitweb = no
会关闭仓库的git-daemon和gitweb访问权限,但由于Apache重写规则仍在,回购仍然可以克隆在http://git.example.com/repo.git
。任何想法如何使用gitosis来管理?
[我最初发布这个问题]
是否有可能使用的gitosis管理到Git仓库http访问?例如,gitosis。CONF我可以使用管理进行的GitWeb和git-妖访问:
# Allow gitweb to show this repository.
gitweb = yes
# Allow git-daemon to publish this repository.
daemon = no
我目前能够通过发出以下命令来克隆我的仓库:
$ git clone git://git.example.com/repo.git
然而,当我发出以下命令:
$ git clone http://git.example.com/repo.git
我收到以下错误信息:
fatal: http://git.example.com/repo.git/info/refs not found: did you run git update-server-info on the server?
但是,如果我登录到我的服务器和运行从repo.git内的下列:
# From http://progit.org/book/ch4-5.html
$ cd project.git
$ mv hooks/post-update.sample hooks/post-update
$ chmod a+x hooks/post-update
$ git update-server-info
然后克隆通过HTTP工作正常。
有没有什么办法可以从gitosis中管理对存储库的http访问?
不作为你的问题的答案,但我听说'gitolite'是新的,仍然保持(和更多的功能)版本的gitosis。 – ikanobori 2010-09-15 22:30:40