Windows下让git shell中的git命令走代理

发布时间 2023-07-30 13:14:54作者: zenghansen

最近用clash跑stable-diffusion,发现git不走代理,间而出现各种问题,故记录一下。

假如只针对GitHub:

git config --global http.https://github.com.proxy http://127.0.0.1:XXXX
git config --global https.https://github.com.proxy https://127.0.0.1:XXXX

假如使用sock5

git config --global http.https://github.com.proxy socks5://127.0.0.1:XXXX
git config --global https.https://github.com.proxy socks5://127.0.0.1:XXXX

取消上面代理

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

假如对git的所有域名都代理就下面

git config --global http.proxy 'http://127.0.0.1:XXXX'
git config --global https.proxy 'http://127.0.0.1:XXXX'