Reputation: 4575
I'm trying to use Git through a proxy. I've tried setting parameters 'git config --global' in a lot of ways but always without success when cloning repositories.
I did:
git config --global http.proxy http://DOMAIN\\\username:[email protected]:8080
git config --global http.sslverify false
git clone http://github.com/project/project.git
And I got:
$ git clone http://github.com/project/project.git folder
Cloning into 'folder'...
error: The requested URL returned error: 407 while accessing http://github.com/project/project.git/info/refs
fatal: HTTP request failed
So, how can I debug this or enable logging in Git to discover why I'm still getting the 407 error? Is there some parameter in Git to verbosely show what is happening to catch the right point where the error is occurring?
Upvotes: 16
Views: 90685
Reputation: 499
If you're already behind a proxy and getting this error, you will have to clear http.proxy
and https.proxy
:
git config --global --unset http.proxy
git config --global --unset https.proxy
Upvotes: 6
Reputation: 21
This works for users on a domain and behind proxy with authentication and HTTPS inspection. Use the following where the %5c is used instead of "\". ie. DOMAIN%5cusername@proxy:port
Open GIT config in editor by entering below command:
git config --global -e
Add/update following sections and save:
[http]
proxy = http://domain%5cusername:password@proxy:port
sslVerify = false
[https]
proxy = http://domain%5cusername:password@proxy:port
sslVerify = false
Upvotes: 2
Reputation: 12033
I had a similar problem trying to git push
from a Git Bash client in Windows.
I fixed it just by browsing to the site using Chrome.
Then I came back to Git Bash and it worked right away
For clarity, my GIT repository URL looks like http://[email protected]/myproject.git
And I browsed to http://www.cloudforge.com
My understanding is that it forces the proxy to resolve this domain.
Upvotes: 13
Reputation: 1324557
Note that for any Git between 2.8 (February 2016, five years after the OP's question) and Git 2.13 (Q2 2017), an invalid proxy configuration would be silently ignored (not even a 407)
See commit ae51d91, commit 5741508 (11 Apr 2017) by Sergey Ryazanov (acteek
).
Helped-by: Jeff King (peff
).
(Merged by Junio C Hamano -- gitster
-- in commit 6b51cb6, 24 Apr 2017)
http: fix the silent ignoring of proxy misconfiguraion
Earlier, the whole
http.proxy
option string was passed tocurl
without any preprocessing socurl
could complain about the invalid proxy configuration.After the commit 372370f ("
http
: use credential API to handle proxy authentication", 2016-01-26), if the user specified an invalid HTTP proxy option in the configuration, then the option parsing silently fails and NULL will be passed to curl as a proxy.
This forcescurl
to fall back to detecting the proxy configuration from the environment, causing thehttp.proxy
option ignoring.Fix this issue by checking the proxy option parsing result. If parsing failed then print an error message and die.
Such behaviour allows the user to quickly figure the proxy misconfiguration and correct it.
Upvotes: 0
Reputation: 1449
If you are inside a corporate firewall and you are using windows git bash then:
Open global gitconfig file, usually this will be under C:\Users\USER_NAME.gitconfig and add the below lines if not exists.
[http]
proxy = http://USER_NAME:PASSWORD@PROXY_URL:PROXY_PORT
sslverify = false
[https]
proxy = http://USER_NAME:PASSWORD@PROXY_URL:PROXY_PORT
sslverify = false
Make sure your password does not have '@' character. If you still have the problem and you are using proxy url instead IP then: Open command - 'Windows Key+R' and type cmd then hit enter execute the command:
nslookup PROXY_URL
This will give some ip addresses. Try these ip addresses in .giconfig instead of PROXY_URL.
Upvotes: 2
Reputation: 766
Your proxy could also be set as an environment variable. Check if your environment has any of the env variables http_proxy or https_proxy set up and unset them.
Using command prompt
# Linux
export http://user:pass@ip_or_host:port
export http://user:pass@ip_or_host:port
# Windows
set HTTP_PROXY = http://user:pass@ip_or_host:port
set HTTPS_PROXY = http://user:pass@ip_or_host:port
change Manually
Upvotes: 1
Reputation: 30528
I think that you should start from the HTTP error: HTTP 407 error explained. And from that you can arrive at the answer: proxy error issue. Hope that helps.
Upvotes: 3
Reputation: 2883
I copied the http proxy section of my .gitconfig to https:
[http]
proxy = http://user:pass@ip_or_host:port
[https]
proxy = http://user:pass@ip_or_host:port
I put an incorrect password in the http proxy just to check, and it was ignored, so it's the https section that was missing for me.
Strangely, on another day that didn't work. I don't know if I'm going crazy or if there's another step I forgot. In today's case, this method of setting the proxy worked (with a cleared .gitconfig) from the command line:
HTTPS_PROXY="http://user:pass@ip_or_host:port/" git clone --progress -v "https://github.com/repo" local_folder
Notes:
DOMAIN\user
.Upvotes: 1
Reputation: 1856
This error may occur if proxy credentials are given, but invalid. In my case, it was an old password.
Upvotes: 1
Reputation: 3302
The following solved the problem for me
Upvotes: 2
Reputation: 15502
You can enable trace logging to get more information about what Git is doing. Following is an example:
GIT_TRACE=$HOME/trace.log git co master
You must use absolute paths if you want to send output to a file. Otherwise, use true or 1 to send output to standard error; e.g. GIT_TRACE=1
.
Upvotes: 7