前言:近期在为写项目时,想要基于第三方库来开发,用到了 git clone https://… 。
问题:git clone时报RPC failed; curl 18 transfer closed with outstanding read data remaining 错误。
原因分析:
- Git 限制了推送、clone 数据的大小导致的错误。
- 缓存区域溢出
- 网络影响,下载速度缓慢造成
解决方案:
- 设置全局的通信缓存大小,增加 git 缓存区的大小
git config --global http.postBuffer 524288000
gi config --list
- 网速问题
git config --global http.lowSpeedLimit 0
git config --global http.lowSpeedTime 999999
- 浅层克隆,深度设置为1
git clone http://github.com/target.git --depth 1 # target.git 为目标地址
cd target #进入库路径目录下
git fetch --unshallow #获取完整库
注意事项:
git fetch --unshallow
必须执行,否则获取不到完整的仓库,导致不能够提交到新的远程仓库中。
当报错提示: ! [remote rejected] master -> master (shallow update not allowed)
请参考: 解决方案