error: RPC failed; curl 56 GnuTLS recv error (-54): Error in the pull function.fatal: The remote end

时间:2024-04-02 10:14:30

error: RPC failed; curl 56 GnuTLS recv error (-54): Error in the pull function.
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed

在运行git clone命令时很容易出现这个错误,这是下载的包太大,网速慢超时报错。由于git默认缓存大小不足导致的,使用下面的命令增加缓存大小。
error: RPC failed; curl 56 GnuTLS recv error (-54): Error in the pull function.fatal: The remote end
解决方案:
1、查看git 配置:

  • 查看当前配置命令: git config -l
    error: RPC failed; curl 56 GnuTLS recv error (-54): Error in the pull function.fatal: The remote end

2、httpBuffer加大

  • 输入命令: git config --global http.postBuffer 524288000
    error: RPC failed; curl 56 GnuTLS recv error (-54): Error in the pull function.fatal: The remote end
  • 此时我们再查看当前配置命令,发现http.postbuffer变成了524288000
    error: RPC failed; curl 56 GnuTLS recv error (-54): Error in the pull function.fatal: The remote end

3.修改配置文件

  • 输入命令: vim ~/.bashrc
    error: RPC failed; curl 56 GnuTLS recv error (-54): Error in the pull function.fatal: The remote end*把以下三行命令添加到文件的最后:具体方法参考添加链接描述

export GIT_TRACE_PACKET=1
export GIT_TRACE=1
export GIT_CURL_VERBOSE=1
error: RPC failed; curl 56 GnuTLS recv error (-54): Error in the pull function.fatal: The remote end
保存退出

4、若还是不行的话:
$ git clone https://github.com/yunjey/pytorch-turorial.git --depth 1
error: RPC failed; curl 56 GnuTLS recv error (-54): Error in the pull function.fatal: The remote end
$ cd pytorch-tutorial
$ git fetch --unshallow
depth用于指定克隆深度,为1即表示只克隆最近一次commit.git shallow clone
git clone 默认会下载项目的完整历史版本,如果你只关心最新版的代码,而不关心之前的历史信息,可以使用 git 的浅复制功能:
git clone --depth=1 https://github.com/yunjey/pytorch-turorial.git
–depth=1 表示只下载最近一次的版本,使用浅复制可以大大减少下载的数据量,例如, CodeIgniter 项目完整下载有近 100MiB ,而使用浅复制只有 5MiB 多,这样即使在恶劣的网络环境下,也可以快速的获得代码。
如果之后又想获取完整历史信息,可以使用下面的命令:
$ git fetch --unshallow
或者,如果你只是想下载最新的代码看看,你也可以直接从 GitHub 上下载打包好的 ZIP 文件,这比浅复制更快,因为它只包含了最新的代码文件,而且是经过 ZIP 压缩的。但是很显然,浅复制要更灵活一点。