通过 https 代理使用时 git clone 超时

标签 git github proxy

命令“git clone https://github.com/user/project.git”在通过 https 代理使用时超时。

我之前已经成功地让 git 在代理后面运行,并且阅读了与 git 和代理使用相关的其他 stackoverflow。现在,我已在我当前组织的主机上将其配置为使用非身份验证代理,但它超时了。

  • 代理是鱿鱼,非身份验证
  • 不能通过 TCP-443 直接连接
  • 我已经确认 git 正在联系代理
  • Git 发出命令“CONNECT github.com:443 HTTP/1.1”
  • 代理允许请求并连接到端口 443 上的 github.com
  • libcurl 验证 github 的证书并建立 SSL 连接 (SSL_RSA_WITH_RC4_128_SHA)
  • git 继续坐在那里,等待从未发生的事情
  • 发生超时

有没有人遇到过这种情况?有什么建议吗?

这是系统版本:

$ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.4 (Santiago)

这是 git 版本和更新信息(RH 中最新可用)

$ git --version
git version 1.7.11.3

$ sudo yum check-update git    
Loaded plugins: downloadonly, rhnplugin, security
This system is receiving updates from RHN Classic or RHN Satellite.

这里是相关的环境变量:

$ export | grep http
declare -x http_proxy="http://proxy.hostname:3128/"
declare -x https_proxy="http://proxy.hostname:3128/"

这是我的 .gitconfig(用于冗余):

$ cat ~/.gitconfig
[http]
        proxy = http://proxy.hostname:3128/
[https]
        proxy = http://proxy.hostname:3128/

这是一个 git 运行(并最终超时)的例子:

$ GIT_CURL_VERBOSE=1 GIT_DEBUG_LOOKUP=1 GIT_TRANSLOOP_DEBUG=1 GIT_TRANSPORT_HELPER_DEBUG=1 git clone https://github.com/user/project.git 2>&1
Cloning into 'project'...
Debug: Remote helper: -> capabilities
Debug: Remote helper: Waiting...
Debug: Remote helper: <- fetch
Debug: Got cap fetch
Debug: Remote helper: Waiting...
Debug: Remote helper: <- option
Debug: Got cap option
Debug: Remote helper: Waiting...
Debug: Remote helper: <- push
Debug: Got cap push
Debug: Remote helper: Waiting...
Debug: Remote helper: <- 
Debug: Capabilities complete.
Debug: Remote helper: Waiting...
* Couldn't find host github.com in the .netrc file; using defaults
* About to connect() to proxy proxy.hostname 3128 (#0)
*   Trying 10.22.74.73... * Connected to proxy.hostname (x.x.x.x) port 3128 (#0)
* Establish HTTP proxy tunnel to github.com:443
> CONNECT github.com:443 HTTP/1.1
Host: github.com:443
User-Agent: git/1.7.11.3
Proxy-Connection: Keep-Alive
Pragma: no-cache

< HTTP/1.0 200 Connection established
< 
* Proxy replied OK to CONNECT request
* Initializing NSS with certpath: sql:/etc/pki/nssdb
*   CAfile: /etc/pki/tls/certs/ca-bundle.crt
  CApath: none
* SSL connection using SSL_RSA_WITH_RC4_128_SHA
* Server certificate:
*   subject: CN=github.com,O="GitHub, Inc.",L=San Francisco,ST=California,C=US,serialNumber=C3268102,incorporationState=California,incorporationCountry=US,businessCategory=Private Organization
*   start date: May 27 00:00:00 2011 GMT
*   expire date: Jul 29 12:00:00 2013 GMT
*   common name: github.com
*   issuer: CN=DigiCert High Assurance EV CA-1,OU=www.digicert.com,O=DigiCert Inc,C=US
* Connected to proxy.hostname (x.x.x.x) port 3128 (#0)

这是鱿鱼日志:

1367957877.701  60148 x.x.x.x TCP_MISS/200 3765 CONNECT github.com:443 - DIRECT/204.232.175.90 -

那么,这里发生了什么?有人有什么想法吗?

最佳答案

我在 CentOS 下的 rpmforge 额外存储库中使用 git 版本 1.7.11.3 时遇到了完全相同的问题

降级到旧版本(我用 1.7.3.4 测试过)解决了这个问题。

要降级你可以这样做

yum --showduplicates list git

这将显示包 git 的所有可用版本

卸载之前安装的git版本:

yum remove git

安装旧版本:

yum install git-1.7.3.4

关于通过 https 代理使用时 git clone 超时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16429416/

相关文章:

git - 为什么 Git 排除运算符排除所有提交,即使是没有后代的提交

git - 将参数传递给 Git 别名命令

ios - Firebase:我应该将 GoogleService-Info.plist 添加到 .gitignore 吗?

java - 如何使用java访问github graphql API

docker - 等待apiserver:WAITING条件超时[kubernetes]

C# webclient 和代理服务器

java - Hibernate 实体代理初始化

git - 如何恢复损坏的 git 存储库?

git - 如何解决 "git pull" merge 冲突到我之前的提交之一?

bash - Git Bash - ssh-keygen 不工作(在生成 RSA key 对之前退出)