Git clone 克隆项目失败
不小心删了本地仓库,重新git clone的过程中非常耗时,且常出现因连接问题导致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,只包含最近的一次commit的一个分支,然后再fetch,可以解决因.git文件过大导致的clone失败。
git clone [project address] --depth 1
cd [project path]
git fetch --unshallow
如果有需要,提供传送门:如何解决Github提交次数过多导致.git文件过大
二、使用开源中国提供的代码托管平台Gitee
- 将待clone的github仓库fork到自己的github
- 申请一个Gitee账户
- 在Gitee界面右上角有一个‘+’号,“从Github/GitLab导入仓库”
- 在弹出的页面中关联Github账户
- 选择“导入Github仓库”,选择对应的仓库“导入”,非常快
- 按照 clone github仓库的方法, clone Gitee账户中的仓库;或者直接下载zip