8

I am getting a connection timeout error when I try to clone a Git repo via a proxy server.

git clone http://opensource.freescale.com/pub/scm/imx/linux-2.6-imx.git
Cloning into linux-2.6-imx...
error: Failed connect to opensource.freescale.com:8080; Connection timed out while accessing http://opensource.freescale.com/pub/scm/imx/linux-2.6-imx.git/info/refs

fatal: HTTP request failed

I used corkscrew and set my git proxy to the server address and port. How else can I download or clone a Git repo over proxy?

random
  • 9,774
  • 10
  • 66
  • 83
user900785
  • 423
  • 3
  • 14
  • 32
  • possible duplicate of [Getting git to work with a proxy server](http://stackoverflow.com/questions/783811/getting-git-to-work-with-a-proxy-server) – Peter Tillemans Mar 16 '12 at 11:30

1 Answers1

11

you do not need corkscrew for accessing a http repo behind a proxy server.

set the environment variable http_proxy

export http_proxy=http://<proxy>:<port>/

and then git will use the http proxy

see also http://roshansingh.wordpress.com/2008/08/29/using-git-behind-proxy/

Peter Tillemans
  • 34,983
  • 11
  • 83
  • 114
  • I had set proxy via command: git config core.gitproxy filename how can I unset this? – user900785 Mar 16 '12 at 12:34
  • git config --unset core.gitproxy – patthoyts Mar 16 '12 at 12:40
  • I did an unset and tried again with error:git clone http://sw-git.freescale.net/linux-2.6-imx.git Cloning into linux-2.6-imx... error: Failed connect to sw-git.freescale.net:8080; Connection timed out while accessing http://sw-git.freescale.net/linux-2.6-imx.git/info/refs fatal: HTTP request failed – user900785 Mar 16 '12 at 13:20
  • 1
    I even explicitly did: git config --global http.proxy $http_proxy ......to no use – user900785 Mar 16 '12 at 13:24
  • once I set http_proxy in the git config as above, I had to use the git site with http equivalent and it worked :) so am going to accept your answer – user900785 Mar 19 '12 at 15:33
  • @user900785 thx, only using it explicitly helped me – FantomX1 Aug 11 '22 at 15:34