# 2021-01-06 #「Git」- 设置网络加速

使用 SOCKS 代理

持久配置

修改配置文件(选项http.proxy适用于HTTP与HTTPS协议):

# 配置当前仓库,以及取消配置
git config http.proxy 'socks5://127.0.0.1:7070'
git config --unset http.proxy

# 全局配置,以及取消配置
git config --global http.proxy 'socks5://127.0.0.1:7070'
git config --global --unset http.proxy

临时配置

仅对本次克隆有效:

git clone https://github.com/xxxxx --config 'http.proxy=socks5://127.0.0.1:1234'

ALL_PROXY='socks5://127.0.0.1:8888' git clone https://github.com/some/one.git

参考文献

K4NZ/设置网络加速
Using a socks proxy with git for the http transport


posted @ 2021-01-06 11:34  研究林纳斯写的  阅读(92)  评论(0编辑  收藏  举报