Reputation: 42967
I am pretty new in Git and GitHub and I think I have some configuration problem.
Yesterday I have correctly configured the SSH connection between my local GIT and my GitHub account. It works fine.
Today I go to the office where I am under a proxy and using the same laptop I try to clone a remote repository (on my GitHub account) to my local repository.
The proxy is correctly setted on my Git, in fact doing:
$ git config --global http.proxy
http://XX.YY.ZZ.AAA:3228
That is the same proxy that I use to navigate on Internet that I have setted into the browser settings.
The problem is that when I try to clone my repository on GitHub into my local repository I obtain this error message:
$ git clone [email protected]:AndreaNobili/recipes.git
Cloning into 'recipes'...
ssh: connect to host github.com port 22: Connection timed out
fatal: Could not read from remote repository.
If I connect to Internet using my smartphone connection (that is not under proxy) it works fine.
Why? What am I missing?
Upvotes: 0
Views: 392
Reputation: 78703
Although you've configured an http proxy, you haven't instructed Git to use http - you've specified that it should use ssh to connect:
$ git clone [email protected]:AndreaNobili/recipes.git
And indeed, your error message is that ssh timed out:
ssh: connect to host github.com port 22: Connection timed out
This happens because you have a firewall blocking your connection. Instead, specify the repository as an HTTP URL, and Git will use the corporate proxy you've configured:
$ git clone https://github.com/AndreaNobili/recipes.git
Upvotes: 1
Reputation: 728
Looks like you need to set the environment variable as http_proxy
as curl
and libcurl
don't seem to recognize upper case variable HTTP_PROXY
.
This link elaborates more on that:
The variable "HTTP_PROXY", using all caps, is no longer permitted/understood (since 7.7.2 actually).
Here's why: When CGI scripts get executed from within web servers, they usually get environment variables set before the script is executed. Headers in the incoming request that activate the script get converted to variables named HTTP_[header].
So, if anyone wrote a CGI script that in turn was using curl, you could actually trick curl to use a http proxy of your choice by passing a 'Proxy: [yada yada]' header.
http_proxy', using lower case, on the other hand is perfectly understood by curl.
Upvotes: 0