我安装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"禁用它们
Mar*_*air 91
您可以删除该配置:
git config --global --unset core.gitproxy
Run Code Online (Sandbox Code Playgroud)
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
git config --global --unset http.proxy
Run Code Online (Sandbox Code Playgroud)