error:RPC failed; curl 92 HTTP/2 stream 5 was not closed cleanly: CANCEL (err 8)
git config --global http.version HTTP/1.1
然后又报了error:RPC failed; curl 18 transfer closed with outstanding read data remaining
后面上网查,竟然是因为网慢
这种情况经常发生,我的互联网连接速度很慢,我必须克隆一个相当大的 git 存储库。最常见的问题是连接关闭并且整个克隆被取消。
Cloning into ‘large-repository’…
remote: Counting objects: 20248, done.
remote: Compressing objects: 100% (10204/10204), 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
经过大量的尝试和错误以及大量的“远程端意外挂断”之后,我找到了一种适合我的方法。这个想法是首先进行浅层克隆,然后用其历史记录更新存储库。
$ git clone http://github.com/large-repository --depth 1
$ cd large-repository
$ git fetch --unshallow
成功了成功了