git clone error: RPC failed; result=22, HTTP code = 502

http://www.jianshu.com/p/645d3fe4e028

git克隆的工程太大用https的方式会有如下问题

hbl:tmp hubert$ git clone https://gitlab.spetechcular.com/aios/aios-for-robot.git
Cloning into 'aios-for-robot'...
error: RPC failed; result=22, HTTP code = 502
fatal: The remote end hung up unexpectedly

解决方法如下

  1. 通过--depth=1参数解决,拉取的只是master分支的shallow,只是最新的commit

    hbl:tmp hubert$ git clone --depth=1 https://gitlab.spetechcular.com/aios/aios-for-robot.git
    Cloning into 'aios-for-robot'...
    remote: Counting objects: 311, done.
    remote: Compressing objects: 100% (257/257), done.
    remote: Total 311 (delta 49), reused 158 (delta 33)
    Receiving objects: 100% (311/311), 35.17 MiB | 92.00 KiB/s, done.
    Resolving deltas: 100% (49/49), done.
    Checking connectivity... done.
  2. 对于在分支开发的开发者来说,不幸的是--depth=1不会把分支拉下来,于是要如下方式,拉取分支到本地

    hbl:aios-for-robot hubert$ git fetch origin lechange:lechange
    remote: Counting objects: 12, done.
    remote: Compressing objects: 100% (11/11), done.
    remote: Total 12 (delta 3), reused 0 (delta 0)
    Unpacking objects: 100% (12/12), done.
    From https://gitlab.spetechcular.com/aios/aios-for-robot
    * [new branch]      lechange   -> lechange
  3. 拉到本地的分支,并不是远程分支,需要设置upstream提交修改

    hbl:aios-for-robot hubert$ git push
    fatal: The current branch lechange has no upstream branch.
    To push the current branch and set the remote as upstream, use
     git push --set-upstream origin lechange

    hbl:aios-for-robot hubert$ git push --set-upstream origin lechange
    Counting objects: 2, done.
    Delta compression using up to 4 threads.
    Compressing objects: 100% (2/2), done.
    Writing objects: 100% (2/2), 315 bytes | 0 bytes/s, done.
    Total 2 (delta 0), reused 0 (delta 0)
    To https://gitlab.spetechcular.com/aios/aios-for-robot.git
    02a4c0c..f4f5357  lechange -> lechange
    Branch lechange set up to track remote branch lechange from origin.



文/刘洪彬(简书作者)
原文链接:http://www.jianshu.com/p/645d3fe4e028
著作权归作者所有,转载请联系作者获得授权,并标注“简书作者”。
允许转载,麻烦注明出处: http://www.cnblogs.com/hanxianlong
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值