Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git clone timed out when used through https proxy

Tags:

git

github

proxy

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?

like image 829
neoCrimeLabs Avatar asked May 07 '13 22:05

neoCrimeLabs


People also ask

How do I clone a large Git repository?

This way you can clone a large repository. First you need to get a shallow clone of depth 1, then fetch a few more commits using 'git fetch' command. Finally, use –unshallow option with git fetch command to get all the remaining commits from repo.

Can't resolve proxy Kali Linux?

The Solution Error: “Could not resolve proxy: https; Unknown error” explains that there is a syntax issue in /etc/sysconfig/rhn/up2date config file for proxy server. Change https to http and then retry the yum update.


1 Answers

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
like image 108
Bogdan Avatar answered Oct 31 '22 12:10

Bogdan