git clone timed out when used through https proxy

15,648

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
Share:
15,648
Admin
Author by

Admin

Updated on June 12, 2022

Comments

  • Admin
    Admin almost 2 years

    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?

  • chrishiestand
    chrishiestand over 10 years
    Thanks, your strategy worked for me in RHEL6, but I removed the rpm and installed a newer version from source. I followed the RHEL6 source code install instructions: access.redhat.com/site/documentation/en-US/…
  • xcorat
    xcorat over 10 years
    This worked for me too. But obviously I hope there's a better solution. I tried updating the SSL certificates and pointing git to use them, still didn't work.
  • Bogdan
    Bogdan over 10 years
    @xcorat Try compiling from source as suggested in the comment above.