6

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

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

  • 代理是 squid,非身份验证
  • 不能通过 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 -

那么,这里发生了什么?有没有人有任何想法?

4

2 回答 2

4

我在 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
于 2013-08-14T11:20:36.977 回答
0

不知道你的问题是否解决了。如果没有,那么也许我的回答可能会有所帮助。在 Git 克隆期间,我的 Visual Studio 2017 遇到了类似的问题,就我而言,我尝试了 Windows 的“<strong>Credential Manager”并寻找 git 的通用凭据。在这里,您可以删除那些现有的 Git 凭据或编辑它们(重置凭据)。

由于上述步骤,下次您使用 Team explorer 和 GIT 进行操作时,VS 2017 将提示用户输入凭据。即使从 GIT bash,我也可以从似乎进行克隆,当我通过凭据管理器编辑设置时,它会更新我本地系统的 GIT 设置。我尝试了这种方法,它帮助我最终从 GIT 获得了东西。

于 2018-12-11T10:41:40.170 回答