Git,Debian,Apache和智能HTTP
问题描述:
我想在我的Debian服务器上设置git。然而,我对这个智能HTTP的东西感到疯狂,因为我想用eclipse的Egit插件,它需要智能HTTP。为此,我无法将我的本地分支推送到我的服务器上的远程存储库。我已经安装了Apache和Git 1.7.2.3。我正在使用基本身份验证,并启用了mod_cgi
,mod_env
和mod_alias
。对于混帐东西,我的Apache配置文件位于/etc/apache2/sites-available/git
,拥有大约下列内容:Git,Debian,Apache和智能HTTP
<VirtualHost *:80>
Servername git.mydomain.com
DocumentRoot /var/git
SetEnv GIT_PROJECT_ROOT /var/git/
SetEnv GIT_HTTP_EXPORT_ALL
ScriptAlias /git/ /usr/lib/git-core/git-http-backend/
<Directory "/var/git">
DAV On
Options +Indexes +FollowSymLinks
Deny from all
AuthType Basic
AuthName "git repository"
AuthUserFile /var/git/.htpasswd
AuthGroupFile /var/git/.htgroup
</Directory>
<Directory /var/git/allternative>
Allow from all
Order allow,deny
Require group allternative
</Directory>
<Directory "/usr/lib/git-core/git-receive-pack">
Allow from all
Order allow,deny
Require group allternative
</Directory>
</VirtualHost>
的diretories如下:
-
/var/git
:这是我的所有存储库将是目录 -
/var/git/allternative
:这是所在的目录(裸)库撒谎说我目前正在试图建立
我做了我在这篇文章上阅读的所有内容(和许多其他人说的一样):http://progit.org/2010/03/04/smart-http.html
我仍然从Egit得到远程智能HTTP未启用的错误。我错过了什么?
由于提前, 安德烈亚斯
答
回答我的问题: 我更换了ScriptAlias
指令与此:
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/lib/git-core/git-http-backend/$1"
,也加入以下指令:
SetEnv REMOTE_USER=$REDIRECT_REMOTE_USER
然后有效。我在http://www.espace.com.eg/blog/2010/11/10/migrating-from-subversion-to-git/上发现了这两个设置,我不确定哪一个解决了问题,但我认为这是SetEnv REMOTE_USER=$REDIRECT_REMOTE_USER
指令。
答
ServerAdmin [email protected]
ServerName git.server.ru
ServerAlias git
UseCanonicalName Off
# path to repo
DocumentRoot /srv/git
DavLockDB "/var/lock/davlock"
SetEnv GIT_PROJECT_ROOT /srv/git
SetEnv GIT_HTTP_EXPORT_ALL
#in Progit http://progit.org/2010/03/04/smart-http.html next line is omitted and
#we get an error. So next line is a mandatory requirement.
SetEnv REMOTE_USER=$REDIRECT_REMOTE_USER
#Don't uncomment line below. It's a second error.
#ScriptAlias//usr/lib/git-core/git-http-backend/
#but this works
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/lib/git-core/git-http-backend/$1"
#making accessible scripts
<Directory /usr/lib/git-core/>
Options +ExecCGI
Order Allow,Deny
Allow from all
</Directory>
#opening access to our git repos
<Directory /srv/git>
Dav on
Order Allow,Deny
Allow from all
Options +Indexes
</Directory>
#need only for auth.
<LocationMatch "^.*/git-receive-pack$">
AuthType Basic
AuthName "Git Access"
AuthUserFile /srv/git/passwd.git
Require valid-user
</LocationMatch>
LogLevel warn
ErrorLog /var/log/httpd/git-error.log
CustomLog /var/log/httpd/git-access.log combined