git clone克隆项目太慢,或者直接导致克不下来的解决办法

从github下载项目下来,由于项目提交历史过多等各种原因导致文件太大,clone的时候非常的慢,或者直接出现

error: RPC failed; curl 18 transfer closed with outstanding read data remaining

fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed

报错,终止下载

两种办法:

1、修改hosts文件,增加映射,这样可以加快clone速度:

151.101.44.249 github.global.ssl.fastly.net
192.30.253.112 github.com

2、避免报错导致下载终止:在clone后面加上参数:--depth 1,设置clone深度为1,来解决这个问题

$ git clone https://github.com/xxx/xxx.git  --depth 1

猜你喜欢

转载自www.cnblogs.com/moonLightcy/p/11812757.html