2012-11-29 3 views
1

NginX 0.8.52를 사용하여 Git Repo를 호스트하려고합니다. fcgiwrap은 git-http-backend를 래핑합니다. 이 설정은 here과 비슷합니다.Git이 치명적으로 반환합니다 : git-http-push failed

다음과 같이 백엔드 fcgiwrap 또한 로그에 불만을
HGs-MacBook-Pro:git_dev hg$ GIT_CURL_VERBOSE=1 git push production master 
* Couldn't find host git.myserver.org in the .netrc file; using defaults 
* About to connect() to git.myserver.org port 443 (#0) 
* Trying 111.222.333.444... 
* Connected to git.myserver.org (111.222.333.444) port 443 (#0) 
* Connected to git.myserver.org (111.222.333.444) port 443 (#0) 
* SSL connection using DHE-RSA-AES256-SHA 
* Server certificate: 
* subject: C=GB; ST=Berkshire; L=Newbury; O=My Company Ltd 
* start date: 2012-11-27 09:56:30 GMT 
* expire date: 2012-12-27 09:56:30 GMT 
* issuer: C=GB; ST=Berkshire; L=Newbury; O=My Company Ltd 
* SSL certificate verify result: self signed certificate (18), continuing anyway. 
> GET /info/refs?service=git-receive-pack HTTP/1.1 
User-Agent: git/1.7.11.4 
Host: git.myserver.org 
Accept: */* 
Pragma: no-cache 

< HTTP/1.1 401 Unauthorized 
< Server: nginx 
< Date: Thu, 29 Nov 2012 01:42:21 GMT 
< Content-Type: text/html 
< Content-Length: 188 
< Connection: close 
< WWW-Authenticate: Basic realm="Restricted" 
< 
* Closing connection #0 
* Issue another request to this URL: 'https://[email protected]/info/refs?service=git-receive-pack' 
* Couldn't find host git.myserver.org in the .netrc file; using defaults 
* About to connect() to git.myserver.org port 443 (#0) 
* Trying 111.222.333.444... 
* Connected to git.myserver.org (111.222.333.444) port 443 (#0) 
* Connected to git.myserver.org (111.222.333.444) port 443 (#0) 
* SSL re-using session ID 
* SSL connection using DHE-RSA-AES256-SHA 
* old SSL session ID is stale, removing 
* Server certificate: 
* subject: C=GB; ST=Berkshire; L=Newbury; O=My Company Ltd 
* start date: 2012-11-27 09:56:30 GMT 
* expire date: 2012-12-27 09:56:30 GMT 
* issuer: C=GB; ST=Berkshire; L=Newbury; O=My Company Ltd 
* SSL certificate verify result: self signed certificate (18), continuing anyway. 
* Server auth using Basic with user 'admin' 
> GET /info/refs?service=git-receive-pack HTTP/1.1 
Authorization: Basic YWRtaW46 
User-Agent: git/1.7.11.4 
Host: git.myserver.org 
Accept: */* 
Pragma: no-cache 

< HTTP/1.1 401 Unauthorized 
< Server: nginx 
< Date: Thu, 29 Nov 2012 01:42:24 GMT 
< Content-Type: text/html 
< Content-Length: 188 
< Connection: close 
* Authentication problem. Ignoring this. 
< WWW-Authenticate: Basic realm="Restricted" 
* The requested URL returned error: 401 
* Closing connection #0 
Password for 'https://[email protected]': 
* Couldn't find host git.myserver.org in the .netrc file; using defaults 
* About to connect() to git.myserver.org port 443 (#0) 
* Trying 111.222.333.444... 
* Connected to git.myserver.org (111.222.333.444) port 443 (#0) 
* Connected to git.myserver.org (111.222.333.444) port 443 (#0) 
* SSL re-using session ID 
* SSL connection using DHE-RSA-AES256-SHA 
* old SSL session ID is stale, removing 
* Server certificate: 
* subject: C=GB; ST=Berkshire; L=Newbury; O=My Company Ltd 
* start date: 2012-11-27 09:56:30 GMT 
* expire date: 2012-12-27 09:56:30 GMT 
* issuer: C=GB; ST=Berkshire; L=Newbury; O=My Company Ltd 
* SSL certificate verify result: self signed certificate (18), continuing anyway. 
* Server auth using Basic with user 'admin' 
> GET /info/refs?service=git-receive-pack HTTP/1.1 
Authorization: Basic REMOVED 
User-Agent: git/1.7.11.4 
Host: git.myserver.org 
Accept: */* 
Pragma: no-cache 

* The requested URL returned error: 404 
* Closing connection #0 
* Couldn't find host git.myserver.org in the .netrc file; using defaults 
* About to connect() to git.myserver.org port 443 (#0) 
* Trying 111.222.333.444... 
* Connected to git.myserver.org (111.222.333.444) port 443 (#0) 
* Connected to git.myserver.org (111.222.333.444) port 443 (#0) 
* SSL re-using session ID 
* SSL connection using DHE-RSA-AES256-SHA 
* old SSL session ID is stale, removing 
* Server certificate: 
* subject: C=GB; ST=Berkshire; L=Newbury; O=My Company Ltd 
* start date: 2012-11-27 09:56:30 GMT 
* expire date: 2012-12-27 09:56:30 GMT 
* issuer: C=GB; ST=Berkshire; L=Newbury; O=My Company Ltd 
* SSL certificate verify result: self signed certificate (18), continuing anyway. 
* Server auth using Basic with user 'admin' 
> GET /info/refs HTTP/1.1 
Authorization: Basic REMOVED 
User-Agent: git/1.7.11.4 
Host: git.myserver.org 
Accept: */* 
Pragma: no-cache 

< HTTP/1.1 200 OK 
< Server: nginx 
< Date: Thu, 29 Nov 2012 01:42:32 GMT 
< Content-Type: text/plain 
< Connection: close 
< Expires: Fri, 01 Jan 1980 00:00:00 GMT 
< Pragma: no-cache 
< Cache-Control: no-cache, max-age=0, must-revalidate 
< Content-Length: 59 
< 
* Closing connection #0 
* Couldn't find host git.myserver.org in the .netrc file; using defaults 
* About to connect() to git.myserver.org port 443 (#0) 
* Trying 111.222.333.444... 
* Connected to git.myserver.org (111.222.333.444) port 443 (#0) 
* Connected to git.myserver.org (111.222.333.444) port 443 (#0) 
* SSL re-using session ID 
* SSL connection using DHE-RSA-AES256-SHA 
* old SSL session ID is stale, removing 
* Server certificate: 
* subject: C=GB; ST=Berkshire; L=Newbury; O=My Company Ltd 
* start date: 2012-11-27 09:56:30 GMT 
* expire date: 2012-12-27 09:56:30 GMT 
* issuer: C=GB; ST=Berkshire; L=Newbury; O=My Company Ltd 
* SSL certificate verify result: self signed certificate (18), continuing anyway. 
* Server auth using Basic with user 'admin' 
> GET /HEAD HTTP/1.1 
Authorization: Basic REMOVED 
User-Agent: git/1.7.11.4 
Host: git.myserver.org 
Accept: */* 
Pragma: no-cache 

< HTTP/1.1 200 OK 
< Server: nginx 
< Date: Thu, 29 Nov 2012 01:42:36 GMT 
< Content-Type: text/plain 
< Connection: close 
< Expires: Fri, 01 Jan 1980 00:00:00 GMT 
< Pragma: no-cache 
< Cache-Control: no-cache, max-age=0, must-revalidate 
< Content-Length: 23 
< Last-Modified: Wed, 28 Nov 2012 12:09:23 +0000 
< 
* Closing connection #0 
Password for 'https://[email protected]': 
* Couldn't find host git.myserver.org in the .netrc file; using defaults 
* About to connect() to git.myserver.org port 443 (#0) 
* Trying 111.222.333.444... 
* Connected to git.myserver.org (111.222.333.444) port 443 (#0) 
* Connected to git.myserver.org (111.222.333.444) port 443 (#0) 
* SSL connection using DHE-RSA-AES256-SHA 
* Server certificate: 
* subject: C=GB; ST=Berkshire; L=Newbury; O=My Company Ltd 
* start date: 2012-11-27 09:56:30 GMT 
* expire date: 2012-12-27 09:56:30 GMT 
* issuer: C=GB; ST=Berkshire; L=Newbury; O=My Company Ltd 
* SSL certificate verify result: self signed certificate (18), continuing anyway. 
> PROPFIND/HTTP/1.1 
User-Agent: git/1.7.11.4 
Host: git.myserver.org 
Accept: */* 
Depth: 0 
Content-Type: text/xml 
Content-Length: 161 
Expect: 100-continue 

< HTTP/1.1 401 Unauthorized 
< Server: nginx 
< Date: Thu, 29 Nov 2012 01:42:43 GMT 
< Content-Type: text/html 
< Content-Length: 188 
< Connection: close 
< WWW-Authenticate: Basic realm="Restricted" 
< 
* Excess found in a non pipelined read: excess = 188 url =/(zero-length body) 
* Closing connection #0 
* Issue another request to this URL: 'https://[email protected]/' 
* Couldn't find host git.myserver.org in the .netrc file; using defaults 
* About to connect() to git.myserver.org port 443 (#0) 
* Trying 111.222.333.444... 
* Connected to git.myserver.org (111.222.333.444) port 443 (#0) 
* Connected to git.myserver.org (111.222.333.444) port 443 (#0) 
* SSL re-using session ID 
* SSL connection using DHE-RSA-AES256-SHA 
* old SSL session ID is stale, removing 
* Server certificate: 
* subject: C=GB; ST=Berkshire; L=Newbury; O=My Company Ltd 
* start date: 2012-11-27 09:56:30 GMT 
* expire date: 2012-12-27 09:56:30 GMT 
* issuer: C=GB; ST=Berkshire; L=Newbury; O=My Company Ltd 
* SSL certificate verify result: self signed certificate (18), continuing anyway. 
* Server auth using Basic with user 'admin' 
> PROPFIND/HTTP/1.1 
Authorization: Basic REMOVED 
User-Agent: git/1.7.11.4 
Host: git.myserver.org 
Accept: */* 
Depth: 0 
Content-Type: text/xml 
Content-Length: 161 
Expect: 100-continue 

< HTTP/1.1 100 Continue 
* We are completely uploaded and fine 
* The requested URL returned error: 404 
* Closing connection #0 
error: Cannot access URL https://[email protected]/, return code 22 
fatal: git-http-push failed 

: 같은 기간 동안

Request not supported: '/home/admin/repo/info/refs?service=git-receive-pack' 

, Nginx에이 오류를보고 그러나, 나는 항상 다음과 같은 오류 (끝의 오류에주의)를 수신 다음의 로그 (정상 나타나는 자식 밀어 보내는 요청 주어진) : 완성도를 위해서

2012/11/29 09:52:42 [error] 15091#0: *3257838 no user/password was provided for basic authentication, client: 222.055.121.111, server: git.myserver.org, request: "GET /info/refs?service=git-receive-pack HTTP/1.1", host: "git.myserver.org" 
2012/11/29 09:52:45 [error] 15092#0: *3257989 user "admin": password mismatch, client: 222.055.121.111, server: git.myserver.org, request: "GET /info/refs?service=git-receive-pack HTTP/1.1", host: "git.myserver.org" 
2012/11/29 09:53:02 [error] 15090#0: *3258816 no user/password was provided for basic authentication, client: 222.055.121.111, server: git.myserver.org, request: "PROPFIND/HTTP/1.1", host: "git.myserver.org" 

을 여기 nginx.conf의 관련 부분입니다 :

# Git 
server { 
    listen 80; 
    listen 443 ssl; 
    server_name git.myserver.org; 

    access_log /home/admin/repo.deploy.log combined; 
    ssl_certificate /etc/nginx/git.myserver.org.self.crt; 
    ssl_certificate_key /etc/nginx/git.myserver.org.self.key; 

    location/{ 
     auth_basic "Restricted"; 
     auth_basic_user_file /etc/nginx/nginx.htpasswd; 

     include fastcgi_params; 

     fastcgi_param SCRIPT_FILENAME /usr/libexec/git-core/git-http-backend; 
     fastcgi_param GIT_HTTP_EXPORT_ALL ""; 
     fastcgi_param GIT_PROJECT_ROOT /home/admin/repo/; 
     fastcgi_param PATH_INFO $request_uri; 

     fastcgi_pass 127.0.0.1:9001; 
    } 
} 

어떤 아이디어로이 문제를 해결할 수 있습니까? 감사!

+0

를, SSH를 사용하여 : //이 작품을 밀어. 그러나 ssh 액세스를 허용하지 않고 여러 사용자와 저장소를 공유하고 싶기 때문에 ssh를 사용할 수 없습니다. – Hengjie

+0

잘 모르겠지만'git_hhtp_backend'에 대한 일반적인 호출은 보통 아파치 설정 파일 (https://github.com/VonC/compileEverything/blob/master/apache/env.conf.tpl#)에서와 같이'GIT_HTTP_BACKEND'를 설정하는 것과 관련이 있습니다. L49) – VonC

+0

GIT_HTTP_BACKEND는'git_http_backend'에 전달되어야하는 환경 변수입니까? – Hengjie

답변

5

이 질문에 대한 답은 PATH_INFO하지 $remote_uri

교체 $uri을 기다리고 있었다입니다 :

fastcgi_param PATH_INFO $request_uri;

문제가 해결

fastcgi_param PATH_INFO $uri;

와 함께. 나는 또한 http 인증을 사용하면서 fastcgi_param REMOTE_USER $remote_user;을 추가했다.

그래서 다음과 같아야합니다 참고로

# Git 
server { 
    listen 80; 
    listen 443 ssl; 
    server_name git.myserver.org; 

    access_log /home/admin/repo.deploy.log combined; 
    ssl_certificate /etc/nginx/git.myserver.org.self.crt; 
    ssl_certificate_key /etc/nginx/git.myserver.org.self.key; 

    location/{ 
     auth_basic "Restricted"; 
     auth_basic_user_file /etc/nginx/nginx.htpasswd; 

     include fastcgi_params; 

     fastcgi_param SCRIPT_FILENAME /usr/libexec/git-core/git-http-backend; 
     fastcgi_param GIT_HTTP_EXPORT_ALL ""; 
     fastcgi_param GIT_PROJECT_ROOT /home/admin/repo/; 
     fastcgi_param PATH_INFO $uri; 
     fastcgi_param REMOTE_USER $remote_user; 

     fastcgi_pass 127.0.0.1:9001; 
    } 
} 
+2

$ uri와 $ remote_uri의 차이점은 $ uri에는 인수가없고 $ remote_uri에 인수가 포함되어 있다는 것입니다. [1] (http://wiki.nginx.org/HttpCoreModule) [소스 코드]의 정규식 (https://github.com/git/git/blob/master/http-backend.c)이 일치 할 것으로 예상됩니다. '/ info/refs $'와 같은 것은'/ info/refs? service = git-receive-pack'과 함께 PATH_INFO를 전달하면'/ info/refs' – Hengjie

+0

매우 흥미로운 피드백. +1 – VonC

+0

감사합니다. 개인적으로 SSL을 통해 모든 것을하고 있기 때문에 config에서 listen 80을 제거했습니다. – Hengjie