【Git】 Clone failed 克隆失敗的解決方法

簡書博客

使用 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

參考

  1. 使用Git clone代碼失敗的解決方法

  2. git pull失敗 error: RPC failed; curl 56 OpenSSL SSL_read: SSL_ERROR_SYSCALL, errfno 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

參考

  1. stackoverflow: error: RPC failed; curl transfer closed with outstanding read data remaining

  2. 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,成功了。。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章