【问题标题】:git push hangs over (dumb) https, after HTTP/1.1 100 Continuegit push 在 HTTP/1.1 之后挂在(哑)https 上 100 继续
【发布时间】:2013-01-07 10:13:21
【问题描述】:

我正在尝试进行一些更改,但 git push 挂起。当我运行git push 时,我看不到任何输出,而且似乎什么也没有发生。 top 没有任何活动,也没有任何迹象。

我不控制 git 托管服务。我正在使用 HTTPS URL。我相信托管服务使用的是哑 HTTPS,而不是 git 的“智能 HTTP”协议。在客户端,我使用 Mac OS X,并通过 Homebrew 安装了 git 1.8.1.1(但使用 Xcode 命令行工具中包含的 git 版本似乎没有什么不同)。注销并重新登录似乎没有帮助。我可以从不同的 Linux 机器中拉取和推送到这个托管服务/存储库。

下面是一些调试输出,显示在客户端发出 PROPFIND 请求后 git push 挂起,从服务器获得 HTTP/1.1 100 Continue 响应,然后什么也没发生:它只是卡住了。

我如何让它工作?有没有我可以尝试的故障排除步骤?

$ GIT_CURL_VERBOSE=1 git push -v
Pushing to https://secure2.svnrepository.com/redacted/redacted/
* About to connect() to secure2.svnrepository.com port 443 (#0)
*   Trying 67.228.18.88...
* Connected to secure2.svnrepository.com (67.228.18.88) port 443 (#0)
* Connected to secure2.svnrepository.com (67.228.18.88) port 443 (#0)
* SSL connection using DHE-RSA-AES256-SHA
* Server certificate:
*    subject: C=US; OU=Domain Control Validated; CN=secure2.svnrepository.com
*    start date: 2012-01-09 16:16:59 GMT
*    expire date: 2015-02-09 02:52:45 GMT
*    subjectAltName: secure2.svnrepository.com matched
*    issuer: O=AlphaSSL; CN=AlphaSSL CA - G2
*    SSL certificate verify ok.
> GET /redacted/redacted/info/refs?service=git-receive-pack HTTP/1.1
User-Agent: git/1.8.1.1
Host: secure2.svnrepository.com
Accept: */*
Accept-Encoding: gzip
Pragma: no-cache

< HTTP/1.1 401 Authorization Required
< Date: Wed, 23 Jan 2013 03:29:36 GMT
< Server: Apache/2.2.3 (Red Hat)
< WWW-Authenticate: Basic realm="redacted"
< Content-Length: 493
< Content-Type: text/html; charset=iso-8859-1
< 
* Ignoring the response-body
* Connection #0 to host secure2.svnrepository.com left intact
* Issue another request to this URL: 'https://secure2.svnrepository.com/redacted/redacted/info/refs?service=git-receive-pack'
* Re-using existing connection! (#0) with host (nil)
* Connected to (nil) (67.228.18.88) port 443 (#0)
* Server auth using Basic with user 'redacted'
> GET /redacted/redacted/info/refs?service=git-receive-pack HTTP/1.1
Authorization: Basic redacted=
User-Agent: git/1.8.1.1
Host: secure2.svnrepository.com
Accept: */*
Accept-Encoding: gzip
Pragma: no-cache

< HTTP/1.1 200 OK
< Date: Wed, 23 Jan 2013 03:29:36 GMT
< Server: Apache/2.2.3 (Red Hat)
< Last-Modified: Wed, 23 Jan 2013 03:00:40 GMT
< ETag: "143802e-3b-e6374600"
< Accept-Ranges: bytes
< Content-Length: 59
< Content-Type: text/plain; charset=UTF-8
< 
* Connection #0 to host (nil) left intact
* Re-using existing connection! (#0) with host (nil)
* Connected to (nil) (67.228.18.88) port 443 (#0)
* Server auth using Basic with user 'redacted'
> GET /redacted/redacted/HEAD HTTP/1.1
Authorization: Basic redacted=
User-Agent: git/1.8.1.1
Host: secure2.svnrepository.com
Accept: */*
Accept-Encoding: gzip
Pragma: no-cache

< HTTP/1.1 200 OK
< Date: Wed, 23 Jan 2013 03:29:36 GMT
< Server: Apache/2.2.3 (Red Hat)
< Last-Modified: Wed, 16 Jan 2013 21:05:31 GMT
< ETag: "d1802c-17-3d0d7cc0"
< Accept-Ranges: bytes
< Content-Length: 23
< Content-Type: text/plain; charset=UTF-8
< 
* Connection #0 to host (nil) left intact
* About to connect() to secure2.svnrepository.com port 443 (#0)
*   Trying 67.228.18.88...
* Connected to secure2.svnrepository.com (67.228.18.88) port 443 (#0)
* Connected to secure2.svnrepository.com (67.228.18.88) port 443 (#0)
* SSL connection using DHE-RSA-AES256-SHA
* Server certificate:
*    subject: C=US; OU=Domain Control Validated; CN=secure2.svnrepository.com
*    start date: 2012-01-09 16:16:59 GMT
*    expire date: 2015-02-09 02:52:45 GMT
*    subjectAltName: secure2.svnrepository.com matched
*    issuer: O=AlphaSSL; CN=AlphaSSL CA - G2
*    SSL certificate verify ok.
> PROPFIND /redacted/redacted/ HTTP/1.1
User-Agent: git/1.8.1.1
Host: secure2.svnrepository.com
Accept: */*
Depth: 0
Content-Type: text/xml
Content-Length: 181
Expect: 100-continue

< HTTP/1.1 100 Continue
* We are completely uploaded and fine
< HTTP/1.1 401 Authorization Required
< Date: Wed, 23 Jan 2013 03:29:37 GMT
< Server: Apache/2.2.3 (Red Hat)
< WWW-Authenticate: Basic realm="redacted"
< Content-Length: 493
< Content-Type: text/html; charset=iso-8859-1
* the ioctl callback returned 0
< 
* Ignoring the response-body
* Connection #0 to host secure2.svnrepository.com left intact
* Issue another request to this URL: 'https://secure2.svnrepository.com/redacted/redacted/'
* Re-using existing connection! (#0) with host (nil)
* Connected to (nil) (67.228.18.88) port 443 (#0)
* Server auth using Basic with user 'redacted'
> PROPFIND /redacted/redacted/ HTTP/1.1
Authorization: Basic redacted=
User-Agent: git/1.8.1.1
Host: secure2.svnrepository.com
Accept: */*
Depth: 0
Content-Type: text/xml
Content-Length: 181
Expect: 100-continue

< HTTP/1.1 100 Continue

我的 Mac OS X 机器上没有 strace,我不知道如何使用 dtruss 来查看它挂起的系统调用,因为 dtruss 要求我是 root,然后 git push 会以不同的方式工作。

更新:我已经在一台带有 git 1.8.1.4 和 strace 的 Linux 机器上复制了这个。运行 strace 在挂起之前显示如下内容:

sendto(4, <redacted>..., 314, 0, NULL, 0) = 314
recvfrom(4, "\27\3\1\0000", 5, 0, NULL, NULL) = 5
recvfrom(4, "E\202\271\21\236p\200\346\374\3641\355\t\275\rLi\202T)\326\271l/\351\f\357\2769Jb\22"..., 48, 0, NULL, NULL) = 48
select(5, [4], [4], [], {0, 729000}) = 1 (out [4], left {0, 728997})
poll([{fd=4, events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}, {fd=4, events=POLLOUT|POLLWRNORM}], 2, 0) = 1 ([{fd=4, revents=POLLOUT|POLLWRNORM}])
select(5, [4], [], [], {0, 729000}) = 0 (Timeout)
poll([{fd=4, events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}], 1, 0) = 0 (Timeout)
...last 2 lines repeat infinitely...

所以它似乎挂起期待从服务器接收一些东西。

另外,我在一个运行 git 1.7.4.4 的旧 Linux 机器上尝试使用 GIT_CURL_VERBOSE=1 git push -v 进行类似的跟踪,它以相同的前缀开始,然后从那里继续。在带有较新 git 的损坏机器上:

$ grep '^> [A-Z]' git-1.8.1.1-trace.stderr
> GET /redacted/redacted/info/refs?service=git-receive-pack HTTP/1.1
> GET /redacted/redacted/info/refs?service=git-receive-pack HTTP/1.1
> GET /redacted/redacted/HEAD HTTP/1.1
> PROPFIND /redacted/redacted/ HTTP/1.1
> PROPFIND /redacted/redacted/ HTTP/1.1

在旧机器上使用旧 git,一切正常:

$ grep '^> [A-Z]' git-1.7.4.4-trace.stderr
> GET /g_wagner/c79-s13/info/refs?service=git-receive-pack HTTP/1.1
> GET /g_wagner/c79-s13/info/refs?service=git-receive-pack HTTP/1.1
> GET /g_wagner/c79-s13/HEAD HTTP/1.1
> PROPFIND /g_wagner/c79-s13/ HTTP/1.1
> PROPFIND /g_wagner/c79-s13/ HTTP/1.1
> HEAD /g_wagner/c79-s13/info/refs HTTP/1.1
> HEAD /g_wagner/c79-s13/objects/info/packs HTTP/1.1
> MKCOL /g_wagner/c79-s13/info/ HTTP/1.1
> LOCK /g_wagner/c79-s13/info/refs HTTP/1.1
> GET /g_wagner/c79-s13/objects/info/packs HTTP/1.1
...
> UNLOCK /g_wagner/c79-s13/info/refs HTTP/1.1

查看两台机器上的完整跟踪,我看不出在有问题的 PROPFIND 请求(第二个 PROPFIND)中发送的内容有任何区别:两个请求似乎是相同的,除了 User-Agent: 标头。

【问题讨论】:

  • &lt; HTTP/1.1 401 Authorization Required 看起来像是身份验证问题。
  • 谢谢,@cjc343。有关如何进一步排除故障的任何提示?我正在使用~/.netrc 进行身份验证,并且我已经确认我的~/.netrc 与我在推送没有问题的另一台(Linux)机器上的值完全相同。我还能够从这台机器上成功提取,这也需要身份验证凭据——所以这一切都非常令人费解。
  • 这当然很奇怪......不幸的是,我对 git over http/s 不是很熟悉,因为我一直使用 ssh 进行身份验证。除非拉取权限意外保持打开状态,否则您无法推送并抛出大多数可能性是没有意义的,例如.netrc 的权限太开放或远程中包含的用户名(我认为会出现上面如果是这种情况),窗外。如果您添加一个包含用户名的遥控器,git 在推送时是否会提示您输入密码(它应该)?希望其他人对出了什么问题有更好的了解...
  • 很明显,它正在尝试查找 git-http-backend,失败,并回退到 DAV。但是您确定实际上支持 DAV 吗?看起来这可能只是一种只读访问方法。
  • @hobbs,打败我!我该怎么说?同样,在运行 git 1.7.4.4 的客户端上,我可以毫无问题地成功推送。我只是在问题中添加了更多信息,其中一些摘录自 git 1.7.4.4(成功推送)的痕迹与 git 1.8.1.2(挂起)的痕迹。我不知道这是否会有所帮助。除了 User-Agent 标头之外,我看不出客户端向服务器发送的内容有任何区别。使用 git 1.7.4.4 客户端时,服务器响应第二个 PROPFIND 并继续,而使用 git 1.8.1.2 客户端时,服务器从不响应。令人费解!

标签: git git-push


【解决方案1】:

我遇到了相同症状的问题(进程挂在HTTP/1.1 100 Continue)。

我找到了一个可以为我解决问题的提交:http-push.c: make CURLOPT_IOCTLDATA a usable pointer,它在 GIT 版本 v2.0.3 中可用。

显然用户在服务器上没有得到正确的身份验证,即使从通信中看起来确实如此。

问题很奇怪,因为对您而言,它显示在一台机器上,但在安装了相同 GIT 版本的另一台机器上却没有,对我来说,GIT 在一个月内停止工作,我真的不能说是什么原因。

如果可能的话,也可以使用允许其他协议的 GIT 服务提供商:SSH 或 HTTPS,这些都可以更好地调试。


对于 Windows 用户,这是我对 git-http-push 2.1.0-rc2 构建的看法(基于 msysGit project instructions

要向后移植到您的 msysGit 安装,请将其解压缩并在 msysGit 安装文件夹中复制/覆盖libexec\git-core\git-http-push.exe

该问题已报告here

更新

最新的msysGit (Git-1.9.4-preview20140815) 包含反向移植的错误修复。

【讨论】:

    猜你喜欢
    • 2015-02-22
    • 1970-01-01
    • 2015-08-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-09-07
    • 2018-04-01
    • 2021-08-29
    相关资源
    最近更新 更多