git加速设置

鉴于国内的特殊环境,当我们在使用git的时候,常常力不从心。对于一些比较大(体积)的项目,看到几k/s的速度时,估计有砸电脑的冲动,所以我们需要给git加速一下!

git加速

全局

  1. 当代*理协议为socks5时:
# socks5协议,1080端口修改成自己的本地代*理端口
git config --global http.proxy socks5://127.0.0.1:1080
git config --global https.proxy socks5://127.0.0.1:1080
  1. 当代*理协议为http时:
# http协议,1081端口修改成自己的本地代*理端口
git config --global http.proxy http://127.0.0.1:1081
git config --global https.proxy https://127.0.0.1:1081

当前

socks5为例:

git config --local http.proxy socks5://192.168.191.136:1080
git config --local https.proxy socks5://192.168.191.136:1080

特殊网站才加速

下面是仅仅针对github进行配置,让github走本地代*理,其他的保持不变:

# socks5协议,1080端口修改成自己的本地代*理端口
git config --global http.https://github.com.proxy socks5://127.0.0.1:1080
git config --global https.https://github.com.proxy socks5://127.0.0.1:1080

查看所有配置

git config -l

恢复默认代*理设置

git config --global --unset http.proxy
git config --global --unset https.proxy
posted @ 2020-04-05 17:54:00 kuye 阅读(6548) 评论(0)
发表评论
昵称
邮箱
网址