GIT 第17章 设置梯子 GIT 第17章 设置梯子

2023-04-15

如果你会使用梯子,并且已经打开了梯子

如果要设置全局代理,可以依照这样设置

git config --global http.proxy http://127.0.0.1:1080
git config --global https.proxy https://127.0.0.1:1080

但请注意,需要查看自己的端口是不是也是1080,可以打开你的梯子查看代理设置

但同时,也请注意,这里指的是 https 协议,也就是

git clone https://www.github.com/xxxx/xxxx.git

这种对于 SSH 协议,也就是

git clone git@github.com:xxxxxx/xxxxxx.git

这种,依旧是无效的

以上为总结,但我不推荐直接用全局代理

因为如果挂了全局代理,这样如果需要克隆 coding 之类的国内仓库,会奇慢无比所以我建议使用这条命令,只对 github 进行代理,对国内的仓库不影响

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

同时,如果在输入这条命令之前,已经输入全局代理的话,可以输入进行取消

git config --global --unset http.proxy
git config --global --unset https.proxy

以上是http代理,也有 socks5 代理的方法

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

打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,你说多少就多少

打开微信扫一扫,即可进行扫码打赏哦

阅读 457