git 在 CONNECT 后从代理返回 http 错误 407
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24907140/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
git returns http error 407 from proxy after CONNECT
提问by Olga Chernyavskaya
I have a problem while connecting to github from my PC, using git. System Win 7.
我在使用 git 从我的 PC 连接到 github 时遇到问题。系统赢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 配置文件中指定了它(在一般 git 文件夹和 git repo 文件夹中)。为此,我在 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:
它在其他程序(例如:maven)上的工作方式如下:
<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:
当我进入“10.65.64.177.com”并尝试推送回购时,我收到:
fatal: unable to access '<repo github link>': Failed connect to github.com:3128; No error
Just don't know what to try.
只是不知道该尝试什么。
回答by Vincent F
What worked for me is something similar to what rohitmohta is proposing ; in regular DOS command prompt (not on git bash) :
对我有用的东西类似于 rohitmohta 的提议;在常规 DOS 命令提示符下(不在 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)
(我确认这是必要的:如果设置为 true,则会出现“SSL 证书问题:无法获得本地颁发者证书”错误)
in my case, no need of defining all_proxy variable
就我而言,不需要定义 all_proxy 变量
and finally
最后
git clone https://github.com/someUser/someRepo.git
回答by Miroslav Mocek
I had to setup all 4 thingsin .gitconfig
with:
我不得不安装所有的4件事中.gitconfig
有:
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.
只有这样,克隆才成功。
回答by rekinyz
Maybe you are already using the system proxysetting - in this case unset all git proxieswill work:
也许您已经在使用系统代理设置 - 在这种情况下,取消设置所有 git 代理都将起作用:
git config --global --unset http.proxy
git config --global --unset https.proxy
回答by Marijus Ravickas
The following command is needed to force git to send the credentials and authentication method to the proxy:
需要以下命令来强制 git 将凭据和身份验证方法发送到代理:
git config --global http.proxyAuthMethod 'basic'
Source: https://git-scm.com/docs/git-config#git-config-httpproxyAuthMethod
来源:https: //git-scm.com/docs/git-config#git-config-httpproxyAuthMethod
回答by rohitmohta
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.
我在公司防火墙后面遇到过类似的问题。执行了以下操作,并且能够从运行 Windows 7 SP1 的系统中使用 git shell 克隆存储库。
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
为您的用户设置“all_proxy”环境变量。curl 需要。
export all_proxy=http://DOMAIN\proxyuser:[email protected]:8080
为您的用户设置“https_proxy”环境变量。curl 需要。
export https_proxy=http://DOMAIN\proxyuser:[email protected]:8080
我不确定这是否有任何影响。但我这样做了,它奏效了:
git config --global http.sslverify false
使用 https:// 进行克隆
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://.
注 1:请勿使用 http://。使用它可能会出现以下错误。可以使用 https:// 解决。
error: RPC failed; result=56, HTTP code = 301
Note-2:Avoid having @ in your password. Can use $ though.
注意 2:避免在密码中包含 @。虽然可以使用 $。
回答by pinei
I had the same problem in a Windows environment.
我在 Windows 环境中遇到了同样的问题。
I just resolved with NTLM-APS (a Windows NT authentication proxy server)
我刚刚解决了 NTLM-APS(Windows NT 身份验证代理服务器)
Configure your NTML proxy and set Git to it:
配置您的 NTML 代理并将 Git 设置为它:
git config --global http.proxy http://<username>:<userpsw>@localhost:<port>
回答by beaumondo
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.
有来自 Android Studio 的 407 错误。尝试添加代理,但没有任何反应。发现它与公司证书有关,所以我从浏览器中导出了它并将其添加到Git。
Export From Web Browser
从 Web 浏览器导出
Internet Options > Content > Certificates > Export (Follow wizard, I chose format "Base 64 encoded X.509(.CER))
Internet 选项 > 内容 > 证书 > 导出(按照向导,我选择了格式“Base 64 编码的 X.509(.CER)”)
In Git Bash
在 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
回答by user1989488
I was facing the same issue, so firstly i checked my npm file what i have set, i checked it with this command:-
我遇到了同样的问题,所以首先我检查了我设置的 npm 文件,我用这个命令检查了它:-
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
之后它对我有用
回答by neo china
Your password seems to be incorrect. Recheck your credentials.
您的密码似乎不正确。重新检查您的凭据。
回答by Кирилл Захаров
I had same problem in my organization.
我在我的组织中遇到了同样的问题。
After many attempts, I came to the following solution:
经过多次尝试,我得出了以下解决方案:
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.
After that I add Git setting
git config --global http.proxyauthmethod ntlm
我向系统管理员申请将代理身份验证类型从 Kerberos 更改为 NTLM。我不确定它是否是强制性的(我在这件事上是个无知的人),但我的申请被批准了。
之后我添加 Git 设置
git config --global http.proxyauthmethod ntlm
Only after that I was able to clone my repository
只有在那之后我才能克隆我的存储库