阿帕奇和git-HTTP后端 [英] Apache and git-http-backend
问题描述
我目前正在建立的Ubuntu 14.04 LTS的机器上一些git仓库与Apache 2.4.7。
I am currently setting up some git repositories on a Ubuntu LTS 14.04 machine with Apache 2.4.7.
这是Apache的配置:
This is the apache config:
SetEnv GIT_PROJECT_ROOT /var/www/html/git
SetEnv GIT_HTTP_EXPORT_ALL 1
SetEnv REMOTE_USER $REDIRECT_REMOTE_USER
ScriptAliasMatch \
"(?x)^/git/(.*/(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
<Location /git/oswald.git>
Options +ExecCGI
AuthType Basic
DAV on
AuthName "Git"
AuthUserFile /etc/apache2/git_paragon_passwd
Require valid-user
Order allow,deny
Allow from all
</Location>
测试库是在 /var/www/html/git/oswald.git
。在资源库中我已经设置了配置属性。
The test repository is under /var/www/html/git/oswald.git
. In the repository I have set the config property
http.receivepack=true
文件 git的守护出口-OK
是present。
如果我现在尝试用克隆:
If I now try to clone with:
git clone https://server/git/oswald.git
认证后,我得到:
after authentication I get:
fatal: https://server/git/oswald.git/info/refs not valid: is this a git repository?
(GIT 2.1.0客户端,服务器上的git的1.9.1)。
(git 2.1.0 client, on the server git 1.9.1).
我试了几件事情,所以如果我不使用git-HTTP后端和通过WebDAV去,我可以克隆,但不能推,使用git-HTTP后端我甚至无法克隆。
I tried several things, so if I don't use git-http-backend and go via WebDAV I can clone but not push, with git-http-backend I cannot even clone.
如果我 ScriptAliasMatch
的最后一行更改从
If I change the last line of ScriptAliasMatch
from
/usr/lib/git-core/git-http-backend
到
/usr/lib/git-core/git-http-backend/$1
在混帐的手册页说明-http后端,我得到
fatal: repository 'https://server/git/oswald.git/' not found
与Apache的error.log中:
with the error.log from Apache:
AH00130: File does not exist: /usr/lib/git-core/git-http-backend/oswald.git/info/refs
没有任何人有一个想法,什么是错的?我已经花了大量的时间通过论坛会,但没有建议有没有帮助至今。
Does anybody have an idea what is wrong? I have already spent a lot of time going through forums, but no suggestions there did help so far.
推荐答案
是否启用了Apache的CGI模块?尝试运行须藤a2enmod CGI
,然后重新启动Apache的。
Is Apache's CGI module enabled? Try running sudo a2enmod cgi
and then restarting Apache.
我有完全相同的问题,这最终被通过CGI模块被禁用的事实引起的。就我而言,上面的命令采摘并启用了cgid进行模块。
I had the exact same issue, which ended up being caused by the fact that the CGI module was disabled. In my case, the above command picked and enabled the "cgid" module.
我相信你需要尾随 $ 1
如果你使用 ScriptAliasMatch
,而应该忽略 $ 1
(但保留后面的斜线)如果你使用的ScriptAlias
。
I believe you need the trailing $1
if you're using ScriptAliasMatch
, but should omit the $1
(but keep the trailing slash) if you're using ScriptAlias
.
您可能还需要添加一个目录
块看起来是这样的:
You may also need to add a Directory
block that looks something like this:
<Directory "/usr/lib/git-core">
Options +ExecCgi -MultiViews +SymLinksIfOwnerMatch
AllowOverride none
Order allow,deny
Allow from all
Require all granted
</Directory>
这篇关于阿帕奇和git-HTTP后端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!