代码之家  ›  专栏  ›  技术社区  ›  Joe

从GitHub提取PR时出现上游错误

  •  0
  • Joe  · 技术社区  · 7 年前

    some_repo .

    git clone some_repo.git (已签出开发分支)

    然后尝试:

    git fetch upstream pull/30/head:dev
    

    这就产生了错误:

    fatal: 'upstream' does not appear to be a git repository
    fatal: Could not read from remote repository.
    
    Please make sure you have the correct access rights
    and the repository exists.
    

    也尝试过:

    git fetch origin pull/30/head:dev
    fatal: Refusing to fetch into current branch refs/heads/dev of non-bare repository
    

    接下来我该怎么办?

    git remote -v                                                                                                                                                                                             
    origin  some_repo.git (fetch)
    origin  ome_repo.git (push)
    


    根据robertklep的建议-能够获得:

    git fetch origin pull/30/head:pr-30
    
    remote: Counting objects: 18, done.
    remote: Compressing objects: 100% (8/8), done.
    remote: Total 18 (delta 10), reused 18 (delta 10), pack-reused 0
    Unpacking objects: 100% (18/18), done.
    From some_repo
     * [new ref]         refs/pull/30/head -> pr-30
    
    git branch -a | cat
    * dev
      pr-30
    
    git checkout pr-30
    
    git branch -a | cat
      dev
    * pr-30
    
    1 回复  |  直到 7 年前
        1
  •  3
  •   robertklep    7 年前

    远程设备的名称为“源”,而不是“上游”:

    git fetch origin pull/30/head:dev
    

    如果 dev

    git fetch origin pull/30/head:pr-30
    

    (新的分支称为 pr-30 )

    推荐文章