Git
clone 太慢国内大部分的git
速度还是挺慢的,前面也提到过使用 镜像或下载站的方式来加速.
这次通过配置git
的代理方式来加速
http
方式git clone
的方法分为 https | ssh
两种,而这两种的代理配置方式也是不同用的.
对于 https | http
方式的链接
# sock 方式
git config --global http.proxy socks5://127.0.0.1:1080
git config --global https.proxy socks5://127.0.0.1:1080
# http 方式
git config --global https.proxy http://127.0.0.1:1080
git config --global https.proxy https://127.0.0.1:1080
git config --global --unset http.proxy
git config --global --unset https.proxy
# 首先需要进入一个 git 的本地仓库
git config https.proxy http://127.0.0.1:1080
git config https.proxy https://127.0.0.1:1080
ssh
方式windows 平台配置
修改 ~/.ssh/config
文件,如果没有创建(没有后缀). 如果创建不了,请将 .ssh
文件夹的权限设置为当前用户完全控制.
添加如下
Host github.com
ProxyCommand connect -H 127.0.0.1:7890 %h 22 #更改 7890 为你自己的本地代理端口
接下来就可以去 clone
测试一下速度了.推荐平时使用ssh
的方式进行clone
和配置代理.