执行git config -l查看代理
取消http代理, 取消https代理
#取消http代理
git config --global --unset http.proxy
#取消https代理
git config --global --unset https.proxy
HTTP 代理
git config --global http.proxy http://127.0.0.1:1080
git config --global https.proxy http://127.0.0.1:1080
Socks5 代理
git config --global http.proxy socks5://127.0.0.1:1080
git config --global https.proxy socks5://127.0.0.1:1080
注意这里的 socks5 仅仅是代理使用的协议,它依然是针对 http 设置的,所以仅对 http 协议的仓库有效。使用 git@xxx 这种 ssh 连接的不会使用代理。
也可以分域名设置代理:
git config --global http.https://github.com.proxy http://127.0.0.1:1080
git config --global https.https://github.com.proxy https://127.0.0.1:1080
SSH 代理
SSH 代理需要在密钥目录 (~/.ssh) (Windows 下是 C:\Users{UserName}.ssh) 新建一个 config 文件,没有后缀名。
Linux 系统写入以下配置(未验证):
需要 netcat
ProxyCommand nc -v -x 127.0.0.1:1080 %h %p
Windows:
-S 为 socks, -H 为 HTTP
ProxyCommand connect -S 127.0.0.1:1080 %h %p
如果找不到 connect 命令那么指定其绝对路径,一般在 git 安装目录下 \mingw64\bin\connect.exe.
也可以分域名代理:
Host github.com
ProxyCommand connect -S 127.0.0.1:1080 %h %p
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。