代码改变世界

git clone 很慢

2020-01-10 15:35  tony4geek  阅读(967)  评论(0编辑  收藏  举报

git clone 依然很慢徘徊在20kb/s,

如果你有代理通过https协议下载,不要用 ssh协议下载

1、配置git全局代理,注意你的端口号是不是1080,打开浏览器查看代理里面可以看到代理到ip和端口号

git config --global http.proxy http://127.0.0.1:7891
git config --global https.proxy https://127.0.0.1:7891

2、通过 git config --global -l查看是否配置成功
我的配置如下

http.proxy=socks5://127.0.0.1:7891
https.proxy=socks5://127.0.0.1:7891

3、如何下载
记住通过 https下载,

git clone --depth=1 https://www.github/xxx/xxxx.git

如果项目很大历史很多,记住 加 个 depth=1 参数,
git clone 是 https 因为这个时候走的是http的代理。

Cloning into 'xxxxx'...
remote: Enumerating objects: 1902, done.
remote: Counting objects: 100% (1902/1902), done.
remote: Compressing objects: 100% (1614/1614), done.
remote: Total 1902 (delta 287), reused 1305 (delta 270), pack-reused 0
Receiving objects: 100% (1902/1902), 50.30 MiB | 5.93 MiB/s, done.
Resolving deltas: 100% (287/287), done.
Checking out files: 100% (1835/1835), done.

看到上面结果没?5.93 MiB/s
美滋滋。