Git over HTTP会在Apache error_log中生成身份验证失败

时间:2017-05-23 11:34:13

标签: git apache http

我的Git over HTTP(s)设置问题非常烦人。即使它在HTTP上工作,我在Apache的error_log中收到一条错误消息,表明存在身份验证失败。我试图跟踪Apache和git客户端之间的通信,似乎git客户端导致了这个问题。

客户端在开始进行身份验证之前尝试加载两次页面。这会在Apache的error_log中生成错误消息。有没有人有任何建议如何解决这个问题?它在制作中真的很烦人(我得到了数以千计的错误)。

________________________________________________________________________________
| hologos@macbook.local [/Users/hologos/Work/Projects/scm/testing-repos/dev/test-opravneni] 
| => GIT_CURL_VERBOSE=1 git pull
* Couldn't find host git-server.local in the .netrc file; using defaults
*   Trying 172.24.144.56...
* Connected to git-server.local (172.24.144.56) port 443 (#0)
* TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
* Server certificate: git-server.local
> GET /dep/bso/test-opravneni.git/info/refs?service=git-upload-pack HTTP/1.1
Host: git-server.local
User-Agent: git/2.10.1 (Apple Git-78)
Accept: */*
Accept-Encoding: gzip
Pragma: no-cache

< HTTP/1.1 401 Unauthorized
< Date: Tue, 23 May 2017 11:09:42 GMT
< Server: Apache/2.4.23 (Unix) OpenSSL/1.0.1e-fips PHP/5.6.24
< WWW-Authenticate: Basic realm="GitList"
< Content-Length: 381
< Content-Type: text/html; charset=iso-8859-1
< 
* Ignoring the response-body
* Connection #0 to host git-server.local left intact
* Issue another request to this URL: 'https://hologos@git-server.local/dep/bso/test-opravneni.git/info/refs?service=git-upload-pack'
* Couldn't find host git-server.local in the .netrc file; using defaults
* Found bundle for host git-server.local: 0x7fe86b50fc10
* Re-using existing connection! (#0) with host git-server.local
* Connected to git-server.local (172.24.144.56) port 443 (#0)
* Server auth using Basic with user 'hologos'
> GET /dep/bso/test-opravneni.git/info/refs?service=git-upload-pack HTTP/1.1
Host: git-server.local
Authorization: Basic bWFsZWtqaXI6
User-Agent: git/2.10.1 (Apple Git-78)
Accept: */*
Accept-Encoding: gzip
Pragma: no-cache

< HTTP/1.1 401 Unauthorized
< Date: Tue, 23 May 2017 11:09:42 GMT
< Server: Apache/2.4.23 (Unix) OpenSSL/1.0.1e-fips PHP/5.6.24
* Authentication problem. Ignoring this.
< WWW-Authenticate: Basic realm="GitList"
< Content-Length: 381
< Content-Type: text/html; charset=iso-8859-1
< 
* Connection #0 to host git-server.local left intact
* Couldn't find host git-server.local in the .netrc file; using defaults
* Found bundle for host git-server.local: 0x7fe86b50fc10
* NTLM-proxy picked AND auth done set, clear picked!
* Hostname git-server.local was found in DNS cache
*   Trying 172.24.144.56...
* Connected to git-server.local (172.24.144.56) port 443 (#1)
* SSL re-using session ID
* TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
* Server certificate: git-server.local
* Server auth using Basic with user 'hologos'
> GET /dep/bso/test-opravneni.git/info/refs?service=git-upload-pack HTTP/1.1
Host: git-server.local
Authorization: Basic bWFsZWtqaXI6NFdlZWR5ZmFpbGFtZW5sZXZlbGJlaGluZA==
User-Agent: git/2.10.1 (Apple Git-78)
Accept: */*
Accept-Encoding: gzip
Pragma: no-cache

< HTTP/1.1 200 OK
< Date: Tue, 23 May 2017 11:09:42 GMT
< Server: Apache/2.4.23 (Unix) OpenSSL/1.0.1e-fips PHP/5.6.24
< Expires: Fri, 01 Jan 1980 00:00:00 GMT
< Pragma: no-cache
< Cache-Control: no-cache, max-age=0, must-revalidate
< Transfer-Encoding: chunked
< Content-Type: application/x-git-upload-pack-advertisement
< 
* Connection #1 to host git-server.local left intact
Already up-to-date.

这里是error_log的输出:

________________________________________________________________________________
| hologos@macbook.local [/Users/hologos/Work/Projects/scm/testing-repos/dev/test-opravneni] 
| => tail error_log
[Tue May 23 13:08:59.666633 2017] [auth_basic:error] [pid 16683] [client 10.0.0.2:54455] AH01617: user hologos: authentication failure for "/dep/bso/test-opravneni.git/info/refs": Password Mismatch

修改

我再次调查它,发现git客户端发出了导致此错误的额外GET请求。我向git dev团队报告了此事。

这是卷曲沟通的输出:

________________________________________________________________________________
| hologos@macbook.local [/Users/hologos] 
| => curl -v --anyauth --user "hologos:password" --silent 'https://git-server.local' 1>/dev/null
* Rebuilt URL to: https://git-server.local/
*   Trying 172.26.232.51...
* Connected to git-server.local (172.26.232.51) port 443 (#0)
* TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
* Server certificate: git-server.local
> GET / HTTP/1.1
> Host: git-server.local
> User-Agent: curl/7.43.0
> Accept: */*
> 
< HTTP/1.1 401 Unauthorized
< Date: Tue, 20 Feb 2018 15:49:15 GMT
< Server: Apache/2.4.23 (Unix) OpenSSL/1.0.1e-fips PHP/5.6.24
< WWW-Authenticate: Basic realm="GitList"
< Content-Length: 381
< Content-Type: text/html; charset=iso-8859-1
< 
* Ignoring the response-body
{ [381 bytes data]
* Connection #0 to host git-server.local left intact
* Issue another request to this URL: 'https://git-server.local/'
* Found bundle for host git-server.local: 0x7fe783412d10
* Re-using existing connection! (#0) with host git-server.local
* Connected to git-server.local (172.26.232.51) port 443 (#0)
* Server auth using Basic with user 'hologos'
> GET / HTTP/1.1
> Host: git-server.local
> Authorization: Basic bWFsZWtqaXI6NEJhZ2dhZ2VzaHl0YW1wZXJwYXJhbHlzaXN3aXNo
> User-Agent: curl/7.43.0
> Accept: */*
> 
< HTTP/1.1 200 OK
< Date: Tue, 20 Feb 2018 15:49:15 GMT
< Server: Apache/2.4.23 (Unix) OpenSSL/1.0.1e-fips PHP/5.6.24
< X-Powered-By: PHP/5.6.24
< Cache-Control: no-cache
< Transfer-Encoding: chunked
< Content-Type: text/html; charset=UTF-8
< 
{ [7 bytes data]
* Connection #0 to host git-server.local left intact

0 个答案:

没有答案