Git:如何删除代理

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/32268986/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 03:31:37  来源:igfitidea点击:

Git: How to remove proxy

gitgithub

提问by Leeuwtje

I am trying to push to my repo but receiving an error:

我正在尝试推送到我的回购,但收到一个错误:

fatal: unable to access 'https://github.com/myrepo.git/': Could not resolve proxy: --list        

I already changed the proxy settings :

我已经更改了代理设置:

git config --global --unset http.proxy  

my global config settings are:

我的全局配置设置是:

push.default=simple
http.sslverify=false
url.https://.insteadof=git://
credential.helper=cache --timeout=3600

But still getting this error? How can I solve this?

但仍然收到此错误?我该如何解决这个问题?

回答by PiTheNumber

Check your enviroment:

检查您的环境:

echo $http_proxy
echo $https_proxy
echo $HTTPS_PROXY
echo $HTTP_PROXY

and delete with export http_proxy=

并删除 export http_proxy=

Or check https and http proxy

或检查 https 和 http 代理

git config --global --unset https.proxy
git config --global --unset http.proxy

Or do you have the proxy in the local config?

或者你在本地配置中有代理?

git config --unset http.proxy
git config --unset https.proxy

回答by Yorsh

Did you already check your proxys here?

你已经在这里检查你的代理了吗?

git config --global --list

or

或者

git config --local --list

回答by Mouli

This is in the case if first answer does not work The latest version of git does not require to set proxy it directly uses system proxy settings .so just do these

这是在第一个答案不起作用的情况下最新版本的 git 不需要设置代理它直接使用系统代理设置。所以只做这些

unset HTTP_PROXY
unset HTTPS_PROXY

in some systems you may also have to do

在某些系统中,您可能还必须执行

unset http_proxy
unset https_proxy

if you want to permanantly remove proxy then

如果你想永久删除代理然后

sudo gsettings set org.gnome.system.proxy mode 'none'

回答by Dinith

You config proxy settings for some network and now you connect another network. Now have to remove the proxy settings. For that use these commands:

您为某个网络配置代理设置,现在您连接另一个网络。现在必须删除代理设置。为此,请使用以下命令:

git config --global --unset https.proxy
git config --global --unset http.proxy

Now you can push too. (If did not remove proxy configuration still you can use git commands like add , commit and etc)

现在你也可以推了。(如果没有删除代理配置仍然可以使用 git 命令,如 add 、 commit 等)

回答by Phani Rithvij

You can list all the global settings using

您可以使用列出所有全局设置

git config --global --list

My proxy settings were set as

我的代理设置被设置为

...
remote.origin.proxy=
remote.origin.proxy=address:port
...

The command git config --global --unset remote.origin.proxydid not work.

该命令git config --global --unset remote.origin.proxy不起作用。

So I found the global .gitconfigfile it was in, using this

所以我找到了.gitconfig它所在的全局文件,使用这个

git config --list --show-origin

And manually removed the proxy fields.

并手动删除了代理字段。

回答by VonC

Check if you have environment variable that could still define a proxy (picked up by curl, even if the git config does not include any proxy setting anymore):

检查您是否有仍然可以定义代理的环境变量(由 选取curl,即使 git config 不再包含任何代理设置):

HTTP_PROXY
HTTPS_PROXY