在windows 命令行下,依次运行如下命令:(设置好git.exe的path路径)
git config --global http.proxy http://127.0.0.1:8087 git config --global https.proxy https://127.0.0.1:8087 git config --global http.sslVerify false
最后这个命令能避免出现SSL certificate problem: unable to get local issuer certificate while accessing错误提示。
使用上面的命令配置完之后,会在 C:\Users\用户名\.gitconfig文件中多出几行:
[http] proxy = http://127.0.0.1:8087 [https] proxy = https://127.0.0.1:8087 sslVerify = false
配置完成后,重新 clone 一遍,可以看到速度得到了极大的提升!
如果想取消代理,则在命令行执行如下命令即可:
引用
git config --global --unset http.proxy
git config --global --unset https.proxy
另外,git clone 默认会下载项目的完整历史版本,如果你只关心最新版的代码,而不关心之前的历史信息,可以使用 git 的浅复制功能,如:
git clone --depth=1 https://github.com/xxx.git
--depth=1 表示只下载最近一次的版本,使用浅复制可以大大减少下载的数据量。