git returns http error 407 from proxy after CONNECT
Solution 1
What worked for me is something similar to what rohitmohta is proposing ; in regular DOS command prompt (not on git bash) :
first
git config --global http.proxy http://username:password@proxiURL:proxiPort
and in some cases also
git config --global https.proxy http://username:password@proxiURL:proxiPort
then
git config --global http.sslVerify false
(I confirm it's necessary : if set to true getting "SSL certificate problem: unable to get local issuer certificate" error)
in my case, no need of defining all_proxy variable
and finally
git clone https://github.com/someUser/someRepo.git
Solution 2
The following command is needed to force git to send the credentials and authentication method to the proxy:
git config --global http.proxyAuthMethod 'basic'
Source: https://git-scm.com/docs/git-config#git-config-httpproxyAuthMethod
Solution 3
Maybe you are already using the system proxy setting - in this case unset all git proxies will work:
git config --global --unset http.proxy
git config --global --unset https.proxy
Solution 4
I had to setup all 4 things in .gitconfig
with:
git config --global http.sslVerify false
git config --global https.sslVerify false
git config --global http.proxy http://user:pass@yourproxy:port
git config --global https.proxy http://user:pass@yourproxy:port
Only then the cloning was successful.
Solution 5
I had faced similar issue, behind corporate firewall. Did the following, and able to clone repository using git shell from my system running Windows 7 SP1.
Set 'all_proxy' environment variable for your user. Required by curl.
export all_proxy=http://DOMAIN\proxyuser:[email protected]:8080
Set 'https_proxy' environment variable for your user. Required by curl.
export https_proxy=http://DOMAIN\proxyuser:[email protected]:8080
I am not sure if this has any impact. But I did this and it worked:
git config --global http.sslverify false
Use https:// for cloning
git clone https://github.com/project/project.git
Note-1: Do not use http://. Using that can give the below error. It can be resolved by using https://.
error: RPC failed; result=56, HTTP code = 301
Note-2: Avoid having @ in your password. Can use $ though.
Related videos on Youtube
Olga Chernyavskaya
Updated on February 24, 2022Comments
-
Olga Chernyavskaya about 2 years
I have a problem while connecting to github from my PC, using git. System Win 7.
I have connection through proxy, so i specified it in git config files (both in general git folder, and in git repo folder). To do this i entered next line to my git bush:
$ git config --global http.proxy http://<username>:<userpsw>@<proxy>:<port>
The way it works on other programms (ex: maven) it looks like that:
<username> - my login to our corp system <userpsw> -my password to corporat system <proxy> - 10.65.64.77 <port> - 3128
But when i try to push or to clone my repo, i receive
fatal: unable to access '<repo githup link>' Received HTTP code 407 from proxy after CONNECT
I try already to enter not just my username but domain\username, changed my password in case there are problems with code language tables. And i even entered wrong password. Error stayed the same.
When i entered in '10.65.64.177.com' and tried to push repo, i received:
fatal: unable to access '<repo github link>': Failed connect to github.com:3128; No error
Just don't know what to try.
-
thinkOfaNumber about 9 yearsDuplicate of stackoverflow.com/questions/8561671? See my answer there about https proxy.
-
Aaron C almost 8 yearsI was getting the same issue after I had updated my windows password on an AD environment. Turns out I just had to restart my proxy server (cntlm).
-
-
Vadorequest about 9 yearsYou can use https_proxy=DOMAIN\"proxyuser:proxypwd"@proxy.server.com:8080 with double quotes and hav an
@
in the password. -
Vadorequest about 9 yearsI know there is a trick using quotes
"
aroundlogin:password
. But I actually tried and git ignored the quotes, so the@
in the password mess it up. If someone has a workaround, I think it's worth mentionning it. -
user130934 almost 9 yearsI have tried all commands suggested above but after that i started getting Received HTTP code 407 from proxy after CONNECT.
-
anre about 8 yearsI did not need "git config --global http.sslVerify false", but this probably depends on the proxy configuration.
-
Bryant about 8 yearsYou can URL encode any special characters. For instance @ becomes %40. meyerweb.com/eric/tools/dencoder
-
Nadeem Iqbal over 7 yearsThis answer is working, and should be marked as correct.
-
Kelly S. French over 7 yearsThis at least kept the error from appearing and generated a prompt for username / password. It seems that the git client is improperly setting the proxy by default sometimes. I've had the same error occur while using SourceTree by Atlassian.
-
kolousek over 7 yearsThis solved the issue for me on Ubuntu 14.04 after much head scratching!
-
jansohn over 7 yearsI wouldn't overwrite the default keystore
"C:\Program Files\Git\mingw64\ssl\certs\ca-bundle.crt"
but instead add your company's certificate to it (maybe in a separate file as described in the link). -
Gaurav Lad over 7 yearsAre you sure about the command: "npm config...", because i guess it should be "git config..."
-
TomSW about 7 yearsThis also solved it for me when using SourceTree, thanks.
-
jxgn about 7 yearsI tried all the options mentioned here and still it's not working for me. :(
-
joeCarpenter almost 6 yearsI was getting this error when attempting to install homebrew...this solved my problem. Thanks.
-
theQuestionMan over 5 yearsNeeded to do it in git bash not DOS for me. I noticed DOS didn't anything! ie. check it by doing: git config --global -l
-
Dhanesh KM about 5 yearsThis was what worked for me at last! after setting the proxy in the config file.
-
Matt about 5 yearsThank you, this is the only thing that worked for me when working from remote location through VPN tunnel.
-
Michel Jung about 5 yearsHow is answer's
git config --global http.proxy http://username:password@proxiURL:proxiPort
different from the question'sgit config --global http.proxy http://<username>:<userpsw>@<proxy>:<port>
other than being less correct, because one needs to specify the proxy host, not the URL? -
Matt almost 5 years@KellyS.French - Yes, because SourceTree is using GIT "under the hood": if Git console doesn't work, then you have issues with SourceTree too.
-
Danyl almost 5 yearsThank you mate, you saved my day ! ;)
-
flederwiesel almost 5 yearsWhy the heck is everyone proposing to circumvent SSL verification??? THIS IS INSECURE and might compromise your system!
-
Polycarp Kavoo over 4 yearsWorks like charm
-
ggranum over 4 years@flederwiesel Because corporate proxies are evil, and cause all sorts of stupidity - like having to store your domain credentials in cleartext in half a dozen places so you can actually access proxied resources. And forcing the use of insecure, company-issued root certificates - or bypassing/ignoring SSL verification entirely. It's quite sad.
-
ggranum over 4 yearsThis was also the missing piece for me. Thank you. (Normally I don't bump with 'me too' comments, but this answer is pretty far down and needs more love).
-
Rakurai almost 4 yearsThis ended up being the only git config option I needed, as my https_proxy environment variable was set in /etc/environment.
-
carloswm85 almost 3 yearsSairam Kukadala's answer → stackoverflow.com/a/44831080/7389293
-
carloswm85 almost 3 yearsWhat if there's another
http.proxyAuthMethod
value? How can I find out what's my system's?