将git代理重置为默认配置

Ahm*_*fei 85 git

我安装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:$1:$2,proxyport=$_proxyport
Run Code Online (Sandbox Code Playgroud)

然后我配置gitproxy使用它:

$ git config --global core.gitproxy gitproxy
Run Code Online (Sandbox Code Playgroud)

现在,我想将git重置为默认代理配置,我该怎么办?

sra*_*mij 170

对我来说,我不得不补充:

git config --global --unset http.proxy
Run Code Online (Sandbox Code Playgroud)

基本上,你可以运行:

git config --global -l 
Run Code Online (Sandbox Code Playgroud)

获取所有代理定义的列表,然后使用"--unset"禁用它们

  • 对于https,使用git config --global --unset https.proxy (5认同)
  • `--unset`的一个令人讨厌的事情是它留下了部分标题,所以最终会有多个空的`[http]`部分污染你的`.gitconfig`.使用`config --global --remove-section http`删除整个`[http]`部分,包括标题. (2认同)

Mar*_*air 91

您可以删除该配置:

git config --global --unset core.gitproxy
Run Code Online (Sandbox Code Playgroud)

  • 对我不起作用..我使用`git config --global --unset http.proxy`,一切都很好 (14认同)

Raj*_*jan 18

编辑.gitconfig文件(可能在用户的主目录中〜)并将http和https代理字段更改为仅空格

[http]
    proxy = 
[https]
    proxy = 
Run Code Online (Sandbox Code Playgroud)

这在窗户中对我有用.


rjd*_*olb 18

在我的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)
Run Code Online (Sandbox Code Playgroud)

我发现我的https_proxy和http_proxy已设置好,所以我只是取消它们.

unset https_proxy
unset http_proxy
Run Code Online (Sandbox Code Playgroud)


use*_*536 12

使用命令删除http和https设置.

git config --global --unset http.proxy

git config --global --unset https.proxy


Rob*_*rls 6

git config --global --unset http.proxy
Run Code Online (Sandbox Code Playgroud)

  • 看来这个答案是三年前由@sramij提供的.这个答案与sramij的答案有何不同?不幸的是,我们目前唯一可以做的就是将此答案标记为垃圾邮件.另请参阅["我也是"类型答案的"无意义答案"的新标志原因](https://meta.serverfault.com/questions/1016/new-flag-reason-for-pointless-answer-for-me-太型的答案). (2认同)