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

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

git clone
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.

  • Remove trailing whitespace on save in Intellij Idea (12)
  • Git/Sourcetree basic branching and merging
  • How to best manage a Git repository for a website in 3 stages?
  • Accessing files of a repository from the Git server
  • How to force git to warn or add new files?
  • Determining how cvs2git converted CVS trees
  • git version is

    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.

  • How to setup a Cron job to do a Git commit
  • How to move the current working branch to master branch in git
  • How to clone all repos at once from GitHub?
  • How do you send code review requests with git when devs do not have public work repositories?
  • Where exactly Git Bash for Windows' prompt is defined?
  • Are there any Git command to combine all our ugly commits together to one?
  • 4 Solutions collect form web for “git behind proxy: remote HEAD refers to nonexistent ref, unable to checkout”

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

    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.

    the packages noted above can be found here:

    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

    A workaround found at the linked Ubuntu bug:

    add the following to ~/.gitconfig or /etc/gitconfig

    # Workaround for bug when using SSL and HTTP proxy (LP #940431)
    [url "http://"]
     insteadOf = "https://"

    No longer necessary starting with 12.04.

    Another simple solution would be:

    regressing libcurl3 from 7.21.0 to 7.19.5.

    Download it from here:



    Git Baby is a git and github fan, let's start git clone.