将 git 代理重置为默认配置
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11265463/
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
Reset git proxy to default configuration
提问by Ahmed Elshafei
I installed Socat to use the Git Protocol Through a HTTP CONNECT Proxy, then I create a script called gitproxy
in your bin directory.
我安装了 Socat 以通过 HTTP CONNECT 代理使用 Git 协议,然后我gitproxy
在你的 bin 目录中创建了一个脚本。
#!/bin/sh
# Use socat to proxy git through an HTTP CONNECT firewall.
# Useful if you are trying to clone git:// from inside a company.
# Requires that the proxy allows CONNECT to port 9418.
#
# Save this file as gitproxy somewhere in your path (e.g., ~/bin) and then run
# chmod +x gitproxy
# git config --global core.gitproxy gitproxy
#
# More details at https://www.emilsit.net/blog/archives/how-to-use-the-git-protocol-through-a-http-connect-proxy/
# Configuration. Common proxy ports are 3128, 8123, 8000.
_proxy=proxy.yourcompany.com
_proxyport=3128
exec socat STDIO PROXY:$_proxy::,proxyport=$_proxyport
then I configured git to use it:
然后我配置了 git 来使用它:
$ git config --global core.gitproxy gitproxy
Now I want to reset git to the default proxy configurations, how can I do that?
现在我想将 git 重置为默认代理配置,我该怎么做?
回答by sramij
For me, I had to add:
对我来说,我不得不补充:
git config --global --unset http.proxy
Basically, you can run:
基本上,您可以运行:
git config --global -l
to get the list of all proxy defined, and then use "--unset" to disable them
获取定义的所有代理的列表,然后使用“--unset”禁用它们
回答by Mark Longair
You can remove that configuration with:
您可以使用以下命令删除该配置:
git config --global --unset core.gitproxy
回答by Rajan
Edit .gitconfig file (Probably in your home directory of the user ~) and change the http and https proxy fields to space only
编辑 .gitconfig 文件(可能在用户的主目录中~)并将 http 和 https 代理字段更改为仅空格
[http]
proxy =
[https]
proxy =
That worked for me in the windows.
这在窗户上对我有用。
回答by rjdkolb
On my Linux machine :
在我的 Linux 机器上:
git config --system --get https.proxy (returns nothing)
git config --global --get https.proxy (returns nothing)
git config --system --get http.proxy (returns nothing)
git config --global --get http.proxy (returns nothing)
I found out my https_proxy and http_proxy are set, so I just unset them.
我发现我的 https_proxy 和 http_proxy 已设置,所以我只是取消设置它们。
unset https_proxy
unset http_proxy
On my Windows machine :
在我的 Windows 机器上:
set https_proxy=""
set http_proxy=""
Optionally use setxto set environment variables permanently on Windows and set system environment using "/m"
可选择使用setx在 Windows 上永久设置环境变量并使用“/m”设置系统环境
setx https_proxy=""
setx http_proxy=""
回答by user2903536
Remove both http and https setting by using commands.
使用命令删除 http 和 https 设置。
git config --global --unset http.proxy
git config --global --unset http.proxy
git config --global --unset https.proxy
git config --global --unset https.proxy
回答by RobsionKarls
git config --global --unset http.proxy
回答by Rahul kalivaradarajalu
If you have used Powershell commands to set the Proxy on windows machine doing the below helped me.
如果您使用 Powershell 命令在 Windows 机器上设置代理,请执行以下操作对我有所帮助。
To unsetthe proxy use: 1. Open powershell 2. Enter the following:
要取消设置代理使用: 1. 打开 powershell 2. 输入以下内容:
[Environment]::SetEnvironmentVariable(“HTTP_PROXY”, $null, [EnvironmentVariableTarget]::Machine)
[Environment]::SetEnvironmentVariable(“HTTPS_PROXY”, $null, [EnvironmentVariableTarget]::Machine)
To setthe proxy again use: 1. Open powershell 2. Enter the following:
要再次设置代理,请使用: 1. 打开 powershell 2. 输入以下内容:
[Environment]::SetEnvironmentVariable(“HTTP_PROXY”, “http://yourproxy.com:yourportnumber”, [EnvironmentVariableTarget]::Machine)
[Environment]::SetEnvironmentVariable(“HTTPS_PROXY”, “http://yourproxy.com:yourportnumber”, [EnvironmentVariableTarget]::Machine)