美文网首页
bug | Git 错误:curl 18 transfer cl

bug | Git 错误:curl 18 transfer cl

作者: cemcoe | 来源:发表于2019-11-20 10:24 被阅读0次

    Git 错误:curl 18 transfer closed with outstanding read data remaining

    RPC failed

    今天想把一个项目 clone 下来,发现 git 报错了,具体如下:

    $ git clone https://github.com/cemcoe/cemcoe.github.io.git
    Cloning into 'cemcoe.github.io'...
    remote: Enumerating objects: 306, done.
    remote: Counting objects: 100% (306/306), done.
    remote: Compressing objects: 100% (218/218), done.
    error: RPC failed; curl 18 transfer closed with outstanding read data remaining
    fatal: the remote end hung up unexpectedly
    fatal: early EOF
    fatal: index-pack failed
    

    刚开始我以为是网络的问题,毕竟网络环境不是很好,换了几个网络后,问题仍然存在。

    先理解一下错误信息
    维基百科中对 RPC 的描述

    远程过程调用(英语:Remote Procedure Call,缩写为 RPC)是一个计算机通信协议。


    有一种解释是:产生问题的原因是项目过大,curl的postBuffer默认值太小的原因
    解决方法是加 buffer,只要 buffer 加的大,什么问题都不怕:
    https://stackoverflow.com/a/38703069/11010570

    git config --global http.postBuffer 524288000
    

    这个代码加了 500M 的 buffer,嗯,我的项目 5.6M (我在后面知道到的),应该不至于过大。


    还有一种解释是:
    https://stackoverflow.com/a/53629086/11010570
    SSH 而不是 https,具体就是使用下面的代码:

    git clone git@github.com:cemcoe/cemcoe.github.io.git
    

    经过尝试是可以的

    git clone git@github.com:cemcoe/cemcoe.github.io.git
    Cloning into 'cemcoe.github.io'...
    remote: Enumerating objects: 306, done.
    remote: Counting objects: 100% (306/306), done.
    remote: Compressing objects: 100% (218/218), done.
    remote: Total 1502 (delta 172), reused 201 (delta 76), pack-reused 1196 eceiving objects:  98% (1472/1502), 5.57 MiB | 14.00 KiB/s
    Receiving objects: 100% (1502/1502), 5.60 MiB | 14.00 KiB/s, done.
    Resolving deltas: 100% (761/761), done.
    

    嗯,5.6M,是时候精简一下了。

    相关文章

      网友评论

          本文标题:bug | Git 错误:curl 18 transfer cl

          本文链接:https://www.haomeiwen.com/subject/phwnictx.html