git 拉取github项目失败(超时)

问题

通过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
4.通过将github项目导入码云,然后再拉取
posted @ 2022-05-05 17:02  太阳是白的  阅读(6035)  评论(0)    收藏  举报