为Git设置代理

Clash为例

HTTP/HTTPS协议

使用 HTTP / HTTPS 传输协议连接到 Git 仓库的 URL 实例如下:

http://github.com/example/example.git
https://github.com/example/example.git
git config --global http.proxy http://127.0.0.1:7890
git config --global http.https://github.com.proxy http://127.0.0.1:7890
git config --global --unset http.proxy
git config --global --unset http.https://github.com.proxy

SSH协议

使用 SSH 传输协议连接到 Git 仓库的 URL 实例如下:

git@github.com:example/example.git
ssh://git@github.com/example/example.git

以下内容仅限Windows端Git

Host github.com
    User git
    ProxyCommand connect -H 127.0.0.1:7890 %h %p