欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 文旅 > 游戏 > gitclone失败

gitclone失败

2025/9/15 21:14:35 来源:https://blog.csdn.net/m0_53870075/article/details/143916385  浏览:    关键词:gitclone失败

unexpected disconnect while reading sideband packet

    • 错误分析
      • 解决办法一
      • 解决办法二
    • 实际操作

remote: Compressing objects: 100% (856/856), done.
error: RPC failed; curl 92 HTTP/2 stream 0 was not closed cleanly: CANCEL (err8)
error: 7891 bytes of body are still expected
fetch-pack: unexpected disconnect while reading sideband packet
fatal: early EOF
fatal: fetch-pack: invalid index-pack output

错误分析

  • RPC Failed: 这表明远程过程调用失败。具体来说,curl 92 HTTP/2 stream 0 was not closed cleanly: CANCEL (err 8) 意味着在使用 HTTP/2 协议时,连接未能正常关闭。这可能是由于网络不稳定、服务器问题或客户端配置问题。

  • Unexpected Disconnect: 这个错误表明在数据传输过程中,连接意外断开。fetch-pack: invalid index-pack output 表示 Git 在解析数据包时遇到了问题,可能是因为数据未能完整接收。

  • 7891 bytes of body are still expected: 这说明 Git 仍在等待接收数据,但连接已断开。

在拉库时,由于校园网限速1Mbps导致连接断开

git clone https://github.com/openvinotoolkit/openvino.git

解决办法一

# 拉取大仓库项目 失败时
$ git clone http://github.com/openvinotoolkit/openvino --depth 1
$ cd openvino
# 尝试将浅克隆转换为完整克隆
$ git fetch --unshallow

解决办法二

git config --global http.version HTTP/1.1
git clone https://github.com/openvinotoolkit/openvino.git 
git config --global http.version HTTP/2

实际操作

  1. 初始化子模块

git submodule init
  1. 浅克隆子模块
git submodule foreach 'git clone --depth 1 $(git config --file $toplevel/.gitmodules submodule.$name.url) $toplevel/$name
'

如果出现问题,子模块已经存在,这是需要跳过
在这里插入图片描述

git submodule foreach 'if [ ! -d "$toplevel/$name" ]; then git clone --depth 1 $(git config --file $toplevel/.gitmodules submodule.$name.url) $toplevel/$name; fi
'

如果还是出现网速问题,更改拉取http协议版本
git config --global http.version HTTP/1.1

  1. 最后进行子模块完整克隆
git fetch --unshallow

如果出现问题

在这里插入图片描述

  • 如果该子模块已经完整且不需要转换为浅克隆,你可以跳过该子模块的 --unshallow 操作。

修改脚本,强制仅对浅克隆子模块执行 --unshallow 操作:

git submodule foreach 'if [ $(git rev-parse --is-shallow-repository) == "true" ]; thengit fetch --unshallowelseecho "Skipping --unshallow for complete repository."fi
'

这样,只有浅克隆的子模块才会尝试 --unshallow,否则就跳过它。
在这里插入图片描述

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词