How to use Git behind proxy on Ubuntu

Last updated on April 4, 2012 by Dan Nanni

If you would like to use Git behind proxy, you can configure proxy settings via a following Git-specific way. Note that setting http_proxy/https_proxy environment variables alone is not sufficient since the variables are ignored by Git. You need to store proxy information in a Git configuration file by using the following command.

$ export http_proxy=
$ git config --global http.proxy $http_proxy
$ git config --global https.proxy $http_proxy

Then, a user-specific Git configuration file (~/.gitconfig) will be created and updated as follows.

    proxy =
    proxy =

For Ubuntu 11.04 or 11.10

If you are using Ubuntu 11.04 or 11.10, you may be getting the following error when trying to clone any repository via https from github:

remote HEAD refers to nonexistent ref, unable to checkout

The error is due to a bug in the libcurl version installed in the particular version of Ubuntu you are using. To solve the problem, manually install the latest libcurl3-gnutls and two dependencies (libp11-kit0 and libgnutls26).

$ 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

Support Xmodulo

This website is made possible by minimal ads and your gracious donation via PayPal (Credit Card) or Bitcoin (1M161JGAkz3oaHNvTiPFjNYkeABox8rb4g).

Please note that this article is published by under a Creative Commons Attribution-ShareAlike 3.0 Unported License. If you would like to use the whole or any part of this article, you need to cite this web page at as the original source.

Xmodulo © 2021 ‒ AboutWrite for UsFeed ‒ Powered by DigitalOcean