Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git behind proxy: remote HEAD refers to nonexistent ref, unable to checkout

Tags:

git

github

When trying to clone ANY repository via https from github, we get:

git clone https://github.com/rails/rails.git
Cloning into rails...
remote HEAD refers to nonexistent ref, unable to checkout

Our server is behind a proxy. We have defined http_proxy and https_proxy appropriately. All other functions are working.

git version is 1.7.5.4

Server is Ubuntu Server 11.04.

Note that since this happens with EVERY github repository we've tried, we strongly believe it's not a problem with the refs in the repository. We've tried such well-known repositories as jquery and rails - if the problem were in those repositories there'd be a lot of people complaining. I believe strongly the problem is with git and the proxy, but all my googling has not lead to a solution.

As an additional data point, clones seem to work fine if they're http. It's only the https clones that fail with this error.

Note that I don't think this question is a duplicate, since the other questions with this error focus on problems with the repository - not working with git and a proxy.

like image 395
wadesworld Avatar asked Dec 06 '11 17:12

wadesworld


People also ask

Why is my git clone not working?

Make sure that the path in the git clone call is correct. If you have an authorization error, have an administrator check the ACLs in Administration > Repositories > <repoName> > Access. Have an administrator check the bare repo in the GitCentric storage directory.

How do I change my origin remote?

Change Git Remote URL For example, let's say that you want to change the URL of your Git origin remote. In order to achieve that, you would use the “set-url” command on the “origin” remote and you would specify the new URL. Congratulations, you successfully changed the URL of your Git remote!


2 Answers

I've stumbled across the solution to this problem via this post:

http://comments.gmane.org/gmane.comp.version-control.git/185459

The issue is apparently a bug in the libcurl version installed in Ubuntu server 11.04. Simply running apt-get install libcurl3-gnutls was not sufficient to solve the problem since it simply reported the latest version was already installed.

To solve the problem, I had to manually install the latest libcurl3-gnutls, and two dependencies, as seen below (obviously, after having downloaded them to my system first):

sudo dpkg -i libp11-kit0_0.6-0ubuntu2_amd64.deb
sudo dpkg -i libgnutls26_2.12.14-3_amd64.deb
sudo dpkg -i libcurl3-gnutls_7.22.0-3ubuntu1_amd64.deb

Hope this helps someone.

like image 112
wadesworld Avatar answered Sep 30 '22 06:09

wadesworld


the packages noted above can be found here:

  • http://packages.ubuntu.com/en/precise/amd64/libp11-kit0/download
  • http://packages.ubuntu.com/en/precise/amd64/libgnutls26/download
  • http://packages.ubuntu.com/en/precise/amd64/libcurl3-gnutls/download

I used these versions and was able to use git behind a proxy without issue:

$ sudo dpkg -i libp11-kit0_0.10-1_amd64.deb libgnutls26_2.12.14-5ubuntu2_amd64.deb libcurl3-gnutls_7.22.0-3ubuntu2_amd64.deb
like image 38
Eric D. White Avatar answered Sep 30 '22 08:09

Eric D. White