git returns http error 407 from proxy after CONNECT

GitGithubProxy

Git Problem Overview


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.

Git Solutions


Solution 1 - Git

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 - Git

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 - Git

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 - Git

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 - Git

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.

  1. Set 'all_proxy' environment variable for your user. Required by curl.

    export all_proxy=http://DOMAIN\proxyuser:[email protected]:8080
    
  2. Set 'https_proxy' environment variable for your user. Required by curl.

    export https_proxy=http://DOMAIN\proxyuser:[email protected]:8080
    
  3. I am not sure if this has any impact. But I did this and it worked:

    git config --global http.sslverify false
    
  4. 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.

Solution 6 - Git

I had the same problem in a Windows environment.

I just resolved with NTLM-APS (a Windows NT authentication proxy server)

Configure your NTML proxy and set Git to it:

git config --global http.proxy http://<username>:<userpsw>@localhost:<port>

Solution 7 - Git

Had the 407 error from Android Studio. Tried adding the proxy, but nothing happened. Found out that it was related to company certificate, so I exported the one from my browser and added it to Git.

Export From Web Browser

Internet Options > Content > Certificates > Export (Follow wizard, I chose format "Base 64 encoded X.509(.CER))

In Git Bash

git config --global http.sslCAInfo c:\Utilities\Certificates\my_certificate

The following page was useful https://blogs.msdn.microsoft.com/phkelley/2014/01/20/adding-a-corporate-or-self-signed-certificate-authority-to-git-exes-store/

To add the proxy, like the other threads I used

git config --global http.proxy proxy.company.net:8080
git config --global https.proxy proxy.company.net:8080

Solution 8 - Git

I was facing the same issue, so firstly i checked my npm file what i have set, i checked it with this command:-

npm config get proxy

and i find out i have set wrong proxy and i set my desire proxy as follow:

npm config set proxy http://xxx.xxx.xxx.4:8080   
npm config set https-proxy http://xxx.xxx.xxx.4:8080

After that it works to me

Solution 9 - Git

I had the same problem too, and tried to solve it by setting explicitly the http.proxyAuthMethod to basic.

After running a pcap trace between my server and the proxy, i noticed that the " HTTP CONNECT" request sent to the proxy during a git clone still not have a "Proxy-Authorization" header set to basic. This was due to my git version "1.8.3.1" that do not support http.proxyAuthMethod.

After installing a newest git version (2.16.6), using rpm packages foud here "https://repo.ius.io/7/x86_64/packages/g/";, setting http.proxyAuthMethod to basic had finally an effect on git behavior and then my git clone was successful.

I hope this helps

Solution 10 - Git

FYI for everyone's information

This would have been an appropriate solution to resolve the following error

Received HTTP code 407 from proxy after CONNECT

So the following commands should be necessary

git config --global http.proxyAuthMethod 'basic'
git config --global https.proxy http://user:pass@proxyserver:port

Which would generate the following config

$ cat ~/.gitconfig
[http]
        proxy = http://user:pass@proxyserver:port
        proxyAuthMethod = basic

Solution 11 - Git

I think you should focus your efforts after you get to this point:

fatal: unable to access '<repo githup link>' Received HTTP code 407 from proxy after CONNECT

This means that you have not properly authenticated with the proxy. Can you double check the password you provide in this step is correct?

git config --global http.proxy http://<username>:<userpsw>@<proxy>:<port>

Solution 12 - Git

Your password seems to be incorrect. Recheck your credentials.

Solution 13 - Git

I had the similar issue and I resolved with below steps:

** Add proxy details in git**

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

Solution 14 - Git

I had same problem in my organization.

After many attempts, I came to the following solution:

  1. I applied to the system administrator to change the proxy authentication type from Kerberos to NTLM. I'm not sure if it was mandatory (I'm an ignoramus in this matter), but my application was approved.

  2. After that I add Git setting

    git config --global http.proxyauthmethod ntlm

Only after that I was able to clone my repository

Solution 15 - Git

This config works in my setup:

[http]
	proxy = <your proxy>
[https]	proxy = <your proxy>
[http]
	sslVerify = false
[https]
	sslVerify = false	
[credential]
    helper = wincred 

Solution 16 - Git

Removing "@" from password worked for me and in anyways never keep @ in your password it will give you issue with maven and further installation

Solution 17 - Git

This issue occured a few days ago with my Bitbucket repositories. I was able to fix it by setting the remote url to http rather than https.

I also tried setting https proxies in the command line and git config but this didn't work.

$ git pull
fatal: unable to access 'https://[email protected]/sacgf/x.git/': Received HTTP code 407 from proxy after CONNECT

Note that we are using https:

$ git remote -v
origin  https://us[email protected]/sacgf/x.git (fetch)
origin  https://us[email protected]/sacgf/x.git (push)

Replace https url with http url:

$ git remote set-url origin http://[email protected]/sacgf/x.git
$ git pull
Username for 'https://bitbucket.org': username
Password for 'https://[email protected]': 
remote: Counting objects: 43, done.
remote: Compressing objects: 100% (42/42), done.
remote: Total 43 (delta 31), reused 0 (delta 0)
Unpacking objects: 100% (43/43), done.
From http://bitbucket.org/sacgf/x
   a41eb87..ead1a92  master     -> origin/master
First, rewinding head to replay your work on top of it...
Fast-forwarded master to ead1a920caf60dd11e4d1a021157d3b9854a9374.
d

Solution 18 - Git

I experienced this error due to my corporate network using one proxy while on premise, and a second (completely different) proxy when VPN'd from the outside. I was originally configured for the on-premise proxy, received the error, and then had to update my config to use the alternate, off-prem, proxy when working elsewhere.

Solution 19 - Git

Have the same problem while using sourcetree Reason was Maybe switching the System Proxy from on to off while sourcetree was open. For some reason this was written into the config file of a project. This can be easily deleted over sourcetree by "Settings" -> "Edit configuration file". Just delete it out there under http

Solution 20 - Git

I encountered the same issue when using Git Bash. When I did the same thing in Command Prompt it worked perfectly.

Solution 21 - Git

I tried all of the solutions but none of them worked. Then I saw my .gitconfig file. It had multiple repeated entries and some of them were not correct(As I had tried multiple solutions). Finally I removed all the redundant and non needed settings and just kept the four settings mentioned by Sairam Kukadala, in his answer above, and Voila! it worked.

Solution 22 - Git

I saw this error when working on a corporate machine on Windows 10 that was not using a proxy.

From the Start menu, I had to open Settings > Network & Internet > Proxy and disable "Automatically detect settings". After doing this, GitHub was immediately able to clone the desired repo.

This may not help anyone else, but it worked for me when nothing else did.

Solution 23 - Git

Here's an alternate answer if you haven't tried any crazy proxy set up. Make sure that you are adding the repository through github.com or github enterprise instead of using a URL. If you are trying to use a github.com repository via the URL, you'll see the 407 error. Once I realized what I was doing my error went away.

enter image description here

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionOlga ChernyavskayaView Question on Stackoverflow
Solution 1 - GitVincent FView Answer on Stackoverflow
Solution 2 - GitMarijus RavickasView Answer on Stackoverflow
Solution 3 - GitrekinyzView Answer on Stackoverflow
Solution 4 - GitMiroslav MocekView Answer on Stackoverflow
Solution 5 - GitrohitmohtaView Answer on Stackoverflow
Solution 6 - GitpineiView Answer on Stackoverflow
Solution 7 - GitbeaumondoView Answer on Stackoverflow
Solution 8 - Gituser1989488View Answer on Stackoverflow
Solution 9 - GitmarwaneLView Answer on Stackoverflow
Solution 10 - GitmeappyView Answer on Stackoverflow
Solution 11 - GitSlakView Answer on Stackoverflow
Solution 12 - Gitneo chinaView Answer on Stackoverflow
Solution 13 - Git0190198View Answer on Stackoverflow
Solution 14 - GitКирилл ЗахаровView Answer on Stackoverflow
Solution 15 - GitmeolView Answer on Stackoverflow
Solution 16 - GitCodieeView Answer on Stackoverflow
Solution 17 - GitDave LawrenceView Answer on Stackoverflow
Solution 18 - GitShawnView Answer on Stackoverflow
Solution 19 - GitSkaView Answer on Stackoverflow
Solution 20 - GitDaniël VerburghView Answer on Stackoverflow
Solution 21 - GitPrateek Mishra View Answer on Stackoverflow
Solution 22 - GitLukeView Answer on Stackoverflow
Solution 23 - GitndwView Answer on Stackoverflow