Git error: RPC 失敗; curl 18 傳輸已關閉 的解決方法

Galois發表於2020-05-30

error information

Cloning into 'xxx'...
remote: Enumerating objects: 4, done.
remote: Counting objects: 100% (4/4), done.
remote: Compressing objects: 100% (4/4), 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

1. 加大快取區

$ git config –global http.postBuffer 524288000

這個大約是 500M

2. 少 clone 一些:–depth 1

$ git clone https://github.com/flutter/flutter.git –depth 1

–depth 1 的含義是複製深度為 1,就是每個檔案只取最近一次提交,不是整個歷史版本。

3. 換協議

clone http 方式換成 SSH 的方式,即 https:// 改為 git://

$ git clone https://github.com/flutter/flutter.git
$ git clone git://github.com/flutter/flutter.git

注意,不是 git@...,比如:git clone git@github.com:flutter/flutter.git 這樣會遇到一些問題比如:

Cloning into 'chord-detection'...
The authenticity of host 'github.com (52.74.223.119)' can't be established.
RSA key fingerprint is SHA256:.......
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'github.com,52.74.223.119' (RSA) to the list of known hosts.
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository

暫時記錄下,這個問題下次解決。

本作品採用《CC 協議》,轉載必須註明作者和本文連結
不要試圖用百米衝刺的方法完成馬拉松比賽。

相關文章