通过https代理使用时,git克隆超时 [英] git clone timed out when used through https proxy

查看:342
本文介绍了通过https代理使用时,git克隆超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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



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




  • 代理是鱿鱼,不认证

  • 通过TCP-443直接连接不是一个选项

  • 我已确认git正在联系代理
  • li>
  • 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 
红帽企业Linux服务器版本6.4(圣地亚哥)

git版本和更新信息(RH中最新版本)

  $ git --version 
git 1.7.11.3

$ sudo yum check-update git
加载的插件:downloadonly,rhnplugin,security
本系统接收来自RHN Classic或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 
克隆到'project'中...
Debug:Remote helper: - >功能
调试:远程助手:正在等待...
调试:远程助手:< - 获取
调试:获取上限获取
调试:远程助手:正在等待...
调试:远程帮助程序:< - 选项
调试:有上限选项
调试:远程帮助程序:等待...
调试:远程帮助程序:< - 推送
调试:获得上限
调试:远程助手:等待...
调试:远程助手:< -
调试:功能完成。
调试:远程助手:正在等待...
*在.netrc文件中找不到主机github.com;使用默认
*关于连接()到代理proxy.hostname 3128(#0)
*尝试10.22.74.73 ... *连接到proxy.hostname(xxxx)端口3128(#0)
*建立到github.com的HTTP代理隧道:443
> CONNECT github.com:443 HTTP / 1.1
Host:github.com:443
User-Agent:git / 1.7.11.3
代理连接:Keep-Alive
Pragma: no-cache

< HTTP / 1.0 200已建立连接
<
*代理回复OK以CONNECT请求
*使用certpath初始化NSS:sql:/ etc / pki / nssdb
* CAfile:/etc/pki/tls/certs/ca-bundle.crt
CApath:none
* SSL连接使用SSL_RSA_WITH_RC4_128_SHA
*服务器证书:
*主题:CN = github.com,O =GitHub,Inc。,L =旧金山,ST = California,C = US,serialNumber = C3268102,incorporationState = California,incorporationCountry = US,businessCategory = Private Organization
*开始日期:5月27日00:00:00 2011 GMT
*过期日期: Jul 29 12:00:00 2013 GMT
*常用名称:github.com
*发行人:CN = DigiCert High Assurance EV CA-1,OU = www.digicert.com,O = DigiCert Inc, C = US
*连接到proxy.hostname(xxxx)端口3128(#0)

这是squid日志:

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

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

解决方案

我从CentOS下的rpmforge extra repository中得到了与1.7.1.3版git相同的问题



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



要降级,您可以做这样的事情

  yum --showduplicates list git 

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



卸载以前安装的git版本:

  yum remove git 

安装旧版本:

  yum install git-1.7.3.4 


The command "git clone https://github.com/user/project.git" times out when being used through an https proxy.

I've successfully had git functioning behind a proxy before, and have read other stackoverflow related to git and proxy usage. Now I've configured it on a host in my current organization to use a non-authenticating proxy, but it's timing out.

  • the proxy is squid, non-authenticating
  • directly connecting via TCP-443 is not an option
  • I've confirmed that git is contacting the proxy
  • Git issues the command "CONNECT github.com:443 HTTP/1.1"
  • The proxy allows the request and connects to github.com on port 443
  • libcurl verifies github's cert and establishes an SSL connection (SSL_RSA_WITH_RC4_128_SHA)
  • git proceeds to sit there, waiting for something that never happens
  • timeout occurs

Has anyone experienced this before? Have any tips?

Here's the system version:

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

Here's the git version and update information (latest available in 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.

Here's the relevant environmental variables:

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

Here's my .gitconfig (for redundancy):

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

Here's an example of git running (and eventually timing out):

$ 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)

Here's the squid log:

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

So, what's going on here? Does anyone have any ideas?

解决方案

I had the EXACT same problem with git version 1.7.11.3 from rpmforge extra repository under CentOS

Downgrading to an older version (I tested with 1.7.3.4) solved the issue.

To downgrade you can do something like this

yum --showduplicates list git

This will show all available versions for package git

Uninstall previously installed git version:

yum remove git

Install an older version:

yum install git-1.7.3.4

这篇关于通过https代理使用时,git克隆超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆