git设置代理提升github clone速度
github在国内访问速度很慢,clone一个项目的速度就10多k每秒,下面是我clone公司维护的spark的速度.
设置代理之后.
速度提升了很多.
1. 设置代理
前提是你有一个速度比较快的代理.
# git clone http://...
git config --global http.proxy socks5://127.0.0.1:1080
# git clone https://...
git config --global https.proxy socks5://127.0.0.1:1080
# git clone git://...
git config --global core.gitproxy socks5://127.0.0.1:1080
端口是你自己的情况而定,一般默认8080,我的设置为11091
2. 取消代理
git config --global --unset http.proxy
git config --global --unset https.proxy
git config --global --unset core.gitproxy
如果之前设置过代理,或想取消代理可以使用这几个命令
3. 使用https clone时遇到HttpReQuestException encoutered && repository not found问题
Github 禁用了TLS v1.0 and v1.1,必须更新Windows的git凭证管理器。
https://github.com/microsoft/Git-Credential-Manager-for-Windows/releases
找到最新的releases版本,下载安装
3. 完整配置
.gitconfig
[user]
name = xxx
email = xxx
[push]
default = current
default = upstream
[credential]
helper = manager
[core]
longpaths = true
gitproxy = socks5://127.0.0.1:1191
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
[http]
proxy = socks5://127.0.0.1:1191
[https]
proxy = socks5://127.0.0.1:1191