我设置了一个git-http-backend CGI脚本来处理我的git.domain
子域。 服务器位于AWS云上的ELB(弹性负载均衡器)之后。 我的服务器configuration如下(我的git托pipe由gitolite处理):
<VirtualHost *:80> ServerName git.domain ServerAdmin hjpotter92+git@domain #SuexecUserGroup git git DocumentRoot /opt/gitolite/repositories/ PerlLoadModule Apache::Authn::Redmine SetEnv GIT_PROJECT_ROOT /opt/gitolite/repositories/ SetEnv REMOTE_USER=$REDIRECT_REMOTE_USER # Have also tried removing this variable SetEnv GIT_HTTP_EXPORT_ALL 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))$" \ /opt/gitolite/git-core/git-http-backend/$1 <Directory "/opt/gitolite/git-core"> AllowOverride None Options +ExecCGI -Includes Require all granted </Directory> <Location /> # enabled in desparation... # saw it somewhere in bugzilla powered mailing list DAV On Order allow,deny Require all granted AuthType Basic AuthName "Git Repositories" AuthUserFile /dev/null Require valid-user PerlAccessHandler Apache::Authn::Redmine::access_handler PerlAuthenHandler Apache::Authn::Redmine::authen_handler RedmineDSN "DBI:mysql:database=redmine;host=endpoint.rds.amazonaws.com" RedmineDbUser "user" RedmineDbPass "your" RedmineGitSmartHttp yes </Location> LogLevel info CustomLog /var/log/apache2/gitolite.access.log combined ErrorLog /var/log/apache2/gitolite.error.log </VirtualHost>
我的apache服务器是由www-data:www-data
user / group运行的,gitolite是用git:git
user / group设置的。 为了让apache读取/写入存储库,我做了:
# usermod -a -G git www-data // and as a desparate measure, in frustration, the following: # usermod -a -G www-data git
PerlAccessHandler
和用户身份validation工作正常,因为我能够使用redmine安装程序的有效凭据克隆我的存储库。
但是,当我试图推动; 我在服务器日志中得到以下内容:
10.0.225.176 [11/Feb/2017:07:46:26 +0530] "GET /xxx.git/info/refs?service=git-upload-pack HTTP/1.1" 401 726 "-" "git/2.11.0" 10.0.225.176 [11/Feb/2017:07:46:27 +0530] "GET /xxx.git/info/refs?service=git-upload-pack HTTP/1.1" 401 725 "-" "git/2.11.0" 10.0.225.176 [11/Feb/2017:07:46:27 +0530] "GET /xxx.git/info/refs?service=git-upload-pack HTTP/1.1" 200 848 "-" "git/2.11.0" 10.0.225.176 [11/Feb/2017:07:46:27 +0530] "POST /xxx.git/git-upload-pack HTTP/1.1" 200 130408 "-" "git/2.11.0"
并在客户端(以下出现在我的负载平衡器,30秒到10分钟的任何连接超时后):
Counting objects: 2, done. Delta compression using up to 4 threads. Compressing objects: 100% (2/2), done. Writing objects: 100% (2/2), 930 bytes | 0 bytes/s, done. Total 2 (delta 1), reused 0 (delta 0) error: RPC failed; HTTP 504 curl 22 The requested URL returned error: 504 GATEWAY_TIMEOUT fatal: The remote end hung up unexpectedly fatal: The remote end hung up unexpectedly
通常情况下,我也有长度为0的git-upload-pack
的POST
(对于同一个存储库中的同一个命令)
10.0.225.222 [11/Feb/2017:07:50:55 +0530] "POST /pandorica.git/git-receive-pack HTTP/1.1" 200 0 "-" "git/2.11.0" 10.0.225.222 [11/Feb/2017:07:53:21 +0530] "POST /pandorica.git/git-receive-pack HTTP/1.1" 200 0 "-" "git/2.11.0"
并在我的服务器错误日志中收到以下内容:
[core:error] [pid 1683] (70007)The timeout specified has expired: [client 10.0.225.176:2534] AH00574: ap_content_length_filter: apr_bucket_read() failed [cgid:error] [pid 1683] (70007)The timeout specified has expired: [client 10.0.225.176:2534] AH02550: Failed to flush CGI output to client
我甚至玩过git用户的setuid和setuid,希望能帮我推送一个仓库。 但无济于事!
chmod u+s /opt/gitolite/repositories chmod g+s /opt/gitolite/repositories // and the same commands for `*.git` inside `repositories`
/opt/gitolite/repositories/xyz.git/
的gitconfiguration:
http.postbuffer=200M core.repositoryformatversion=0 core.filemode=true core.bare=true redminegitolite.projectid=xxx http.receivepack=true http.uploadpack=true
对于参考资料,我已经完成了以下各项:
如何设置Apache VHost,使其开始接受git push
。