Git/代理

来自康健生活
< Git
Kangkk​(留言 | 贡献)2025年6月27日 (五) 05:38的版本 (→分流)

全局代理

/home/kangkk
git config --global http.proxy http://192.168.51.34:808
git config --global https.proxy https://192.168.51.34:808

取消代理

/home/kangkk
git config --global --unset http.proxy
git config --global --unset https.proxy

分流

只对特定仓库进行代理

/home/kangkk
git config --global http.https://github.com.proxy http://192.168.51.34:808
git config --global https.https://github.com.proxy http://192.168.51.34:808

或者使用 socks

/home/kangkk
git config --global http.https://github.com.proxy socks5://192.168.51.34:1080
git config --global https.https://github.com.proxy socks5://192.168.51.34:1080

配置文件

~/.gitconfig
[http]
proxy = socks5://192.168.51.34:1080
proxy = http://192.168.51.34:1080

[https]
proxy = socks5://192.168.51.34:1080
proxy = https://192.168.51.34:1080
/home/kangkk
git config -l --global