git拉取项目太大失败(超时)

本文详细介绍了当通过Git拉取GitHub大型项目时遇到'fetch-pack: unexpected disconnect'等问题的常见原因及解决方法,包括使用镜像、限制深度克隆、调整http.postBuffer等。
摘要由CSDN通过智能技术生成

问题

通过git拉取GitHub上的项目失败报错信息如下

fetch-pack: unexpected disconnect while reading sideband packet
fatal: early EOF
fatal: fetch-pack: invalid index-pack output

原因:因为拉取的项目过大导致失败

解决

1.利用镜像网站
将链接中的 github.com 替换为 github.com.cnpmjs.org 

如果方法1报以下错误

Could not resolve host: github.com.cnpmjs.org

在git控制台上输入下面这句,然后在正常去拉取,它会使你默认使用镜像

git config --global url."https://hub.fastgit.xyz/".insteadOf https://github.com/
2.拉取最近提交的一次提交,然后再拉取全部
git clone --depth 1 [链接] 
git fetch --unshallow
3.延长克隆的时间
git config --global http.postBuffer 600000
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值