问题
通过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
本文详细介绍了当通过Git拉取GitHub大型项目时遇到'fetch-pack: unexpected disconnect'等问题的常见原因及解决方法,包括使用镜像、限制深度克隆、调整http.postBuffer等。
644





