【发布时间】:2023-03-30 23:14:01
【问题描述】:
我目前正在使用 Apache 2.4.7 的 Ubuntu LTS 14.04 机器上设置一些 git 存储库。
这是 apache 配置:
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 下。在存储库中,我设置了配置属性
http.receivepack=true
文件git-daemon-export-ok 存在。
如果我现在尝试克隆:
git clone https://server/git/oswald.git
认证后我得到:
fatal: https://server/git/oswald.git/info/refs not valid: is this a git repository?
(git 2.1.0 客户端,在服务器 git 1.9.1 上)。
我尝试了几件事,所以如果我不使用 git-http-backend 并通过 WebDAV 我可以克隆但不能推送,使用 git-http-backend 我什至无法克隆。
如果我将ScriptAliasMatch 的最后一行从
/usr/lib/git-core/git-http-backend
到
/usr/lib/git-core/git-http-backend/$1
如man page of git-http-backend 中所述,我明白了
fatal: repository 'https://server/git/oswald.git/' not found
来自 Apache 的 error.log:
AH00130: File does not exist: /usr/lib/git-core/git-http-backend/oswald.git/info/refs
有人知道出了什么问题吗?我已经花了很多时间浏览论坛,但到目前为止没有任何建议有帮助。
【问题讨论】:
标签: git apache git-http-backend