使用 Android Studio,想 clone 項目,但是進度條下載一段時間後就會報錯失敗。
// 報錯 1
Clone failed
early EOF
The remote end hung up unexpectedly
index-pack failed
RPC failed; curl 56 OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 10054
參考
分析爲 Git 限制了推送數據的大小導致的錯誤。
於是,重新設置全局的通信緩存大小。
// 方法 1
git config --global http.postBuffer 524288000
但是,我用了上述方法後,還是失敗。
這次的報錯爲:
// 報錯 2
Clone failed
early EOF
The remote end hung up unexpectedly
index-pack failed
RPC failed; curl 18 transfer closed with outstanding read data remaining
參考
-
stackoverflow: error: RPC failed; curl transfer closed with outstanding read data remaining
-
git報錯–RPC failed; curl 18 transfer closed with outstanding read data remaining
// 方法 2
將 clone 地址的 `https://` 改爲 `git://`,再嘗試重新 clone 項目。
OK~小型項目 clone 沒有問題了。但是,大型項目還是不行,進度條一直卡在開始的地方。
根據 stackoverflow 的另外一條回答,推斷是項目太大,而網速過慢。可以先設置深度爲 1 進行淺克隆,克隆完成後再進行 update 操作更新項目代碼。
// 方法 3
git clone http://github.com/large-repository --depth 1
cd large-repository
git fetch --unshallow
不過,我使用這個方法還是報錯 curl 18 transfer closed with outstanding read data remaining
。
然後我關了 vpn,再次使用方法 2,成功了。。