- 問題:git clone 下載代碼一直報錯誤
Cloning into 'aplanmis-project'...
remote: Enumerating objects: 176887, done.
remote: Counting objects: 100% (176887/176887), done.
remote: Compressing objects: 100% (75181/75181), 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 config --global http.postBuffer 524288000 # 2GB
git config --global http.postBuffer 2097152000 # 2GB
git config --global http.postBuffer 3194304000 # 3GB
- 執行上面命令如果依舊clone失敗,考慮可能原因2:網絡下載速度緩慢
git config --global http.lowSpeedLimit 0 git config --global http.lowSpeedTime 999999
2.用http方式下載代碼,發現可能依舊會存在該問題,用ssh方式來下載代碼,下面是ssh公鑰配置的說明
- 碼雲提供了基於SSH協議的Git服務,在使用SSH協議訪問倉庫倉庫之前,需要先配置好賬戶/倉庫的SSH公鑰。可以參考:https://gitee.com/help/articles/4181#article-header0官網配置
生產ssh公鑰: ssh-keygen -t rsa -C "xxxxx@xxxxx.com"
郵箱地址: xxxxx@xxxxx.com
- 按照提示完成三次回車,即可生成 ssh key。通過查看
~/.ssh/id_rsa.pub
文件內容,獲取到你的 public key
- 登錄碼雲官網,點擊個人LOGO,選擇“設置”、“安全設置”、“ssh公鑰”,添加生成的 public key 添加到倉庫中。
- 測試是否可以連接成功
ssh -T git@gitee.com
- 用ssh方式下載代碼,發現可下載代碼
git clone git@gitee.com:......ssh地址