我在 VM 上使用 git 1.8.4.2(运行最新的 archlinux),我们称它为机器 A。远程源位于本地网络上,并通过带有身份验证的 https 工作。我可以毫无问题地推送它,但 fetch 或 clones 通常会挂断。
我在网络(机器 B)上有另一个虚拟机(运行 Ubuntu LTS 12.04),运行 git 1.7.9.5,它能够完美地获取。
我恰好能够从机器A ssh 到机器B,但不能到远程源,所以当前的工作是从远程源获取临时存储库中的机器B,然后通过ssh 使用git 从B 到 A。但这显然不能令人满意。
以下是使用 GIT_CURL_VERBOSE=1 的一些输出(IP 地址和主机名已更改):
== 在机器 A 上(尝试失败):
$ GIT_CURL_VERBOSE=1 git fetch
* Couldn't find host remote.localdomain in the .netrc file; using defaults
* Adding handle: conn: 0x1d60460
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x1d60460) send_pipe: 1, recv_pipe: 0
* About to connect() to remote.localdomain port 443 (#0)
* Trying XX.XX.XXX.XX...
* Connected to remote.localdomain (XX.XX.XXX.XX) port 443 (#0)
* successfully set certificate verify locations:
* CAfile: /etc/ssl/certs/ca-certificates.crt
CApath: none
* SSL connection using DHE-RSA-AES256-GCM-SHA384
* Server certificate:
* subject: C=XX; ST=XXX; L=Xxxxxxx; O=Xxxxx; OU=Xxxxx; CN=remote.localdomain; name=remote; emailAddress=someone@somewhere.com
* start date: 2013-01-10 14:30:42 GMT
* expire date: 2023-01-08 14:30:42 GMT
* issuer: C=XX; ST=XXX; L=Xxxxxxx; O=Xxxxx; OU=Xxxxx; CN=dev.localdomain; name=Pince; emailAddress=someone@somewhere.com
* SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
> GET /repository/info/refs?service=git-upload-pack HTTP/1.1
User-Agent: git/1.8.4.2
Host: remote.localdomain
Accept: */*
Accept-Encoding: gzip
Pragma: no-cache
< HTTP/1.1 401 Authorization Required
< Date: Fri, 08 Nov 2013 09:21:45 GMT
* Server Apache is not blacklisted
< Server: Apache
< WWW-Authenticate: Basic realm="LDAP Company.org"
< Vary: Accept-Encoding
< Content-Encoding: gzip
< Content-Length: 290
< Content-Type: text/html; charset=iso-8859-1
<
* Connection #0 to host remote.localdomain left intact
* Couldn't find host remote.localdomain in the .netrc file; using defaults
* Found bundle for host remote.localdomain: 0x1d60e20
* Re-using existing connection! (#0) with host remote.localdomain
* Connected to remote.localdomain (XX.XX.XXX.XX) port 443 (#0)
* Adding handle: conn: 0x1d60460
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x1d60460) send_pipe: 1, recv_pipe: 0
> GET /repository/info/refs?service=git-upload-pack HTTP/1.1
User-Agent: git/1.8.4.2
Host: remote.localdomain
Accept: */*
Accept-Encoding: gzip
Pragma: no-cache
< HTTP/1.1 401 Authorization Required
< Date: Fri, 08 Nov 2013 09:21:45 GMT
* Server Apache is not blacklisted
< Server: Apache
< WWW-Authenticate: Basic realm="LDAP Company.org"
< Vary: Accept-Encoding
< Content-Encoding: gzip
< Content-Length: 290
< Content-Type: text/html; charset=iso-8859-1
<
* Ignoring the response-body
* Connection #0 to host remote.localdomain left intact
* Issue another request to this URL: 'https://remote.localdomain/repository/info/refs?service=git-upload-pack'
* Couldn't find host remote.localdomain in the .netrc file; using defaults
* Found bundle for host remote.localdomain: 0x1d60e20
* Re-using existing connection! (#0) with host remote.localdomain
* Connected to remote.localdomain (XX.XX.XXX.XX) port 443 (#0)
* Adding handle: conn: 0x1d60460
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x1d60460) send_pipe: 1, recv_pipe: 0
* Server auth using Basic with user 'user'
> GET /repository/info/refs?service=git-upload-pack HTTP/1.1
Authorization: Basic VDAxMzY4NDU6cGFyaXM3MjI=
User-Agent: git/1.8.4.2
Host: remote.localdomain
Accept: */*
Accept-Encoding: gzip
Pragma: no-cache
< HTTP/1.1 200 OK
< Date: Fri, 08 Nov 2013 09:21:45 GMT
* Server Apache is not blacklisted
< Server: Apache
< 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
<
(然后卡在这里)
== 在机器 B 上(成功尝试):
$ GIT_CURL_VERBOSE=1 git fetch
* Couldn't find host remote.localdomain in the .netrc file; using defaults
* About to connect() to remote.localdomain port 443 (#0)
* Trying XX.XX.XXX.XX... * Connected to remote.localdomain (XX.XX.XXX.XX) port 443 (#0)
* found 153 certificates in /etc/ssl/certs/ca-certificates.crt
* server certificate verification SKIPPED
* compression: NULL
* cipher: AES-128-CBC
* MAC: SHA1
> GET /repository/info/refs?service=git-upload-pack HTTP/1.1
User-Agent: git/1.7.9.5
Host: remote.localdomain
Accept: */*
Pragma: no-cache
* The requested URL returned error: 401
* Closing connection #0
* Couldn't find host remote.localdomain in the .netrc file; using defaults
* About to connect() to remote.localdomain port 443 (#0)
* Trying XX.XX.XXX.XX... * Connected to remote.localdomain (XX.XX.XXX.XX) port 443 (#0)
* found 153 certificates in /etc/ssl/certs/ca-certificates.crt
* SSL re-using session ID
* server certificate verification SKIPPED
* compression: NULL
* cipher: AES-128-CBC
* MAC: SHA1
> GET /repository/info/refs?service=git-upload-pack HTTP/1.1
User-Agent: git/1.7.9.5
Host: remote.localdomain
Accept: */*
Pragma: no-cache
< HTTP/1.1 401 Authorization Required
< Date: Fri, 08 Nov 2013 09:33:06 GMT
< Server: Apache
< WWW-Authenticate: Basic realm="LDAP Company.org"
< Vary: Accept-Encoding
< Content-Length: 401
< Content-Type: text/html; charset=iso-8859-1
<
* Ignoring the response-body
* Connection #0 to host remote.localdomain left intact
* Issue another request to this URL: 'https://remote.localdomain/repository/info/refs?service=git-upload-pack'
* Couldn't find host remote.localdomain in the .netrc file; using defaults
* Re-using existing connection! (#0) with host remote.localdomain
* Connected to remote.localdomain (XX.XX.XXX.XX) port 443 (#0)
* Server auth using Basic with user 'user'
> GET /repository/info/refs?service=git-upload-pack HTTP/1.1
Authorization: Basic VDAxMzY4NDU6cGFyaXM3MjI=
User-Agent: git/1.7.9.5
Host: remote.localdomain
Accept: */*
Pragma: no-cache
< HTTP/1.1 200 OK
< Date: Fri, 08 Nov 2013 09:33:06 GMT
< Server: Apache
< 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 #0 to host remote.localdomain left intact
(然后该命令简单地返回而没有错误)。
任何人都知道问题是什么?
编辑:进一步的测试表明在机器 A 上编译 v1.7.9.5 仍然不起作用(与 v1.8.4.2 的行为完全相同)。
所以这要么是 Archlinux 特有的,要么是由 git 的依赖项之一的不同版本引起的……我会说 curl 和 openssl 是主要候选者。
多次运行该命令后,我再次收到一个新错误:
fatal: unable to access 'https://remote.localdomain/repository/': transfer closed with outstanding read data remaining
我正在调查这个错误...