当前位置:   article > 正文

git clone --depth=1时的一些问题_http 504 curl 22 the requested url returned, depth

http 504 curl 22 the requested url returned, depth 失败

https://www.jianshu.com/p/1031dd2a6c3a

当项目过大时,git clone时会出现error: RPC failed; HTTP 504 curl 22 The requested URL returned error: 504 Gateway Time-out的问题,如下图

 

image.png

 

解决方法很简单,在git clone时加上--depth=1即可解决

depth用于指定克隆深度,为1即表示只克隆最近一次commit.

这种方法克隆的项目只包含最近的一次commit的一个分支,体积很小,即可解决文章开头提到的项目过大导致Timeout的问题,但会产生另外一个问题,他只会把默认分支clone下来,其他远程分支并不在本地,所以这种情况下,需要用如下方法拉取其他分支:

  1. $ git clone --depth 1 https://github.com/dogescript/xxxxxxx.git
  2. $ git remote set-branches origin 'remote_branch_name'
  3. $ git fetch --depth 1 origin remote_branch_name
  4. $ git checkout remote_branch_name

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小蓝xlanll/article/detail/405086
推荐阅读
相关标签
  

闽ICP备14008679号