GIT 通过 HTTPS 共享 git-接收包失败

GIT shared over HTTPS git-receive-pack fails

我正在尝试配置我自己的私人 git 服务器以使其通过 HTTP 可用,但我遇到困难,需要一些帮助。

我查看了几个关于如何通过 HTTP 服务 git 存储库的教程,我认为几乎所有的部分都在正确的位置,因为目前我能够从不同的多个客户端克隆远程存储库工作站,我还可以使用 gitWeb 应用程序浏览存储库。

我可以从客户端 运行 git commit 命令,但我无法将更改推送到 master 分支。

git push 命令记录以下错误:

remote: error: unable to create temporary file: Operation not permitted
remote: fatal: failed to write object
error: unpack failed: unpack-objects abnormal exit

更新:经过几次测试,我成功地从几个客户端推送了四次运行ning。成功推送只是重复多次执行同一命令。这让我相信问题可能出在服务器端的一些过载问题上,不允许接收更改,但我仍然无法理解缺少哪个配置。

环境如下:

$ uname -av
Linux odroid 3.8.13.30 #1 SMP PREEMPT Fri Feb 20 14:34:08 BRST 2015 armv7l armv7l armv7l GNU/Linux

$ apache2 -version
Server version: Apache/2.4.7 (Ubuntu)
Server built:   Jan 14 2016 17:49:32

$ git --version
git version 1.9.1

权限应该不是问题,因为存储库文件夹对 运行正在使用 apache 服务的组具有读写权限

$ ls /var/git/repos
drwxrwx--- 0 odroid www-data 0 may 28 23:15 testremote.git
drwxrwx--- 0 odroid www-data 0 may 28 23:17 test

$ ps aux | grep apache
root      4524  0.0  0.8 107588 17836 ?        Ss   may25   0:17 /usr/sbin/apache2 -k restart
www-data  7797  0.0  0.4 107836  8372 ?        S    00:35   0:00 /usr/sbin/apache2 -k restart
www-data  7798  0.0  0.3 107636  7392 ?        S    00:35   0:00 /usr/sbin/apache2 -k restart
www-data  7799  0.0  0.4 107836  8300 ?        S    00:35   0:00 /usr/sbin/apache2 -k restart
www-data  7800  0.0  0.3 107692  7916 ?        S    00:35   0:00 /usr/sbin/apache2 -k restart
www-data  7801  0.0  0.3 107636  7392 ?        S    00:35   0:00 /usr/sbin/apache2 -k restart
www-data  7812  0.0  0.3 107636  7404 ?        S    00:35   0:00 /usr/sbin/apache2 -k restart

我当前的 apache 配置是:

            SetEnv GIT_PROJECT_ROOT /mnt/wh13/sandbox/git/repo/
            SetEnv GIT_HTTP_EXPORT_ALL 1
            SetEnv REMOTE_USER $REDIRECT_REMOTE_USER
            ScriptAliasMatch "(?x)^/git/\
                     (.*\.git/(HEAD|info/refs|objects/\
                     (info/[^/]+|[0-9a-f]{40}\.(pack|idx))|git-(upload|receive)-pack))$"\
                      /usr/lib/git-core/git-http-backend/

            ScriptAlias /git/ /usr/share/gitweb/
            ScriptLog ${APACHE_LOG_DIR}/cgi_log.log
            <Directory /usr/share/gitweb>
               Options +FollowSymLinks +ExecCGI
               AddHandler cgi-script .cgi
               DirectoryIndex gitweb.cgi
            </Directory>
            <Directory "/usr/lib/git-core*">
               Options ExecCGI Indexes
               AuthType Basic
               AuthName "GIT Repositories"
               AuthUserFile /mnt/wh13/sandbox/git/htpasswd.git
               Require valid-user
               Order allow,deny
               Allow from all
            </Directory>
            <Directory "/usr/share/gitweb/static">
               Options -ExecCGI +Indexes
               SetHandler default-handler
            </Directory>

我不明白哪个操作是不允许的,并且尝试使用 ScriptLog ${APACHE_LOG_DIR}/cgi_log.log 指令从 CGI 脚本中获取更多详细信息,但没有提供任何有用的信息。

任何人都可以就如何进一步排查和解决问题提供一些建议吗?

提前致谢,抱歉拖了这么久 post

Git 2.21(2019 年第一季度)在遇到这些错误时可能会更加稳健。

http-backend CGI 进程没有正确清理它产生的子进程到 运行 upload-pack 等。当它自己死掉时,已经更正了。

commit 02818a9 (24 Nov 2018) by Max Kirillov (max630)
帮助:Carlo Arenas (carlosJoseloMtz).
(由 Junio C Hamano -- gitster -- in commit ea8620b 合并,2019 年 1 月 4 日)

http-backend: enable cleaning up forked upload/receive-pack on exit

If http-backend dies because of errors, started upload-pack or receive-pack are not killed and waited, but rather stay running for some time until they exit because of closed stdin.

It may be undesirable in working environment, and it also causes occasional failure of t5562, because the processes keep opened act.err, and sometimes write there errors after next test started using the file.

Fix by enabling cleaning of the command at http-backend exit.