有时候git项目比较大,git clone会因为各种原因中断,但是Git并不会断点续“传”再次clone又是重新来过,类似这种问题…让人很是苦恼
1 | $ error: RPC failed; HTTP 504 curl 22 The requested URL returned error: 504 Gateway Time-out |
解决方式
git配置流
1
2
3
4$ git config --global http.lowSpeedLimit 0 // 最小速度
$ git config --global http.lowSpeedTime 999999 // 最大速度
$ git config --global http.postBuffer 524288000 // 文件大小
$ git config --global compression 0 // 关闭压缩分块拉取
1
$ git clone --depth=1 {repo} // 拉取最新的代码(最后一次commit)
但这样会带来其他的小问题,就是拉下来的代码默认分支既不是master也不是其他分支 … 需要拉取完整的项目
1
2
3$ git fetch --unshallow // 拉取深层代码
$ git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" // 修正remote关系(修改之前: "fetch = +refs/heads/master:refs/remotes/origin/master")
$ git fetch -pv // 拉取所有分支