git git拒绝在没有代理的情况下连接
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/30828237/
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 refuses to connect without proxy
提问by Kshitiz Sharma
I work on a Linux system in a Windows environment. To authenticate with a NT proxy server I had setup cntlm
and configured system programs to use it via setting http_proxy
environment variable in the /etc/environment
file.
我在 Windows 环境中的 Linux 系统上工作。为了使用 NT 代理服务器进行身份验证,我已经设置cntlm
并配置了系统程序以通过http_proxy
在/etc/environment
文件中设置环境变量来使用它。
Now I want to remove this proxy setting and have the programs connect directly.
现在我想删除此代理设置并让程序直接连接。
So I unset the system environment variables:
所以我取消设置系统环境变量:
unset http_proxy
unset HTTP_PROXY
Check ~/.gitconfig
to ensure that there are no proxy entries.
检查~/.gitconfig
以确保没有代理条目。
Explicitly instruct git
not to use any proxies:
明确指示git
不要使用任何代理:
git config --global --unset http.proxy
git config --global --unset https.proxy
Verify that no proxy is configured:
验证没有配置代理:
git config --system --get https.proxy
git config --global --get https.proxy
git config --system --get http.proxy
git config --global --get http.proxy
And then push to a remote repo:
然后推送到远程仓库:
git push
But git
still tries to connect via proxy:
但git
仍然尝试通过代理连接:
fatal: unable to access 'https://[email protected]/xxx.git/': Failed to connect to 127.0.0.1 port 3128: Connection refused
致命:无法访问“ https://[email protected]/xxx.git/”:无法连接到 127.0.0.1 端口 3128:连接被拒绝
Why won't it let go off cntlm
?
为什么不放手cntlm
?
回答by VonC
The easiest check to do is:
最简单的检查是:
env|grep -i proxy
The OP confirms:
OP确认:
I thought I had removed
proxy
by unsethttp_proxy
.
But there is a different environment variable for HTTPS which needs to be unset separately. Runningenv|grep -i proxy
revealed that.
我以为我已经
proxy
通过 unset删除了http_proxy
。
但是 HTTPS 有一个不同的环境变量,需要单独取消设置。跑步env|grep -i proxy
揭示了这一点。
回答by venky
- use
cat ~/.
this will list all the files. - use
cat ~/.gitconfig
this will open the contents of file. If you find any proxies there remove it like
[http] proxy = http://127.0.0.1:3128
You can remove it by using
nano ~/.gitconfig
command.Now this command will work.
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
- 使用
cat ~/.
这将列出所有文件。 - 使用
cat ~/.gitconfig
这将打开文件的内容。 如果您在那里找到任何代理,请将其删除
[http] 代理 = http://127.0.0.1:3128
您可以使用
nano ~/.gitconfig
命令将其删除。现在这个命令将起作用。
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
ALSO REMEMBER to remove all the proxies like
还记得删除所有的代理,如
unset http_proxy="http_proxy"
unset https_proxy=$http_proxy
unset ftp_proxy=$http_proxy
unset rsync_proxy=$http_proxy
unset HTTP_PROXY=$http_proxy
unset HTTPS_PROXY=$http_proxy
unset FTP_PROXY=$http_proxy
unset RSYNC_PROXY=$http_proxy
Remember to remove proxies from system preferences network and proxies uncheck all the check boxes now try to do.
请记住从系统首选项网络中删除代理,代理取消选中现在尝试执行的所有复选框。