簡體   English   中英

無法從GitHub分叉存儲庫簽出分支

[英]Cannot checkout branch from GitHub forked repository

我試圖從我的分叉存儲庫中檢出一個分支,但它給出了一個錯誤:

存儲庫: https//github.com/tmsblgh/codechecker/tree/issue799

MacBook-Pro:codechecker tmsblgh$ git branch -vv
* master acdc482 [origin/master] Merge pull request #1636 from gyorb/version68
MacBook-Pro:codechecker tmsblgh$ git --version
git version 2.17.1
MacBook-Pro:codechecker tmsblgh$ git fetch
MacBook-Pro:codechecker tmsblgh$ git checkout issue799
error: pathspec 'issue799' did not match any file(s) known to git.
Baloghs-MacBook-Pro:codechecker tmsblgh$ git remote -v
origin  https://github.com/tmsblgh/codechecker.git (fetch)
origin  https://github.com/tmsblgh/codechecker.git (push)
MacBook-Pro:codechecker tmsblgh$ git checkout issue799
error: pathspec 'issue799' did not match any file(s) known to git.

這個分支可能不在您的本地git設置中。 試試git checkout origin/issue799

PS:原點是你指向的遙控器

您可以設置本地分支來跟蹤遠程:

git checkout -b issue799 origin/issue799

編輯(回應評論):

我不知道你為什么會收到錯誤,但這是我從頭開始做的事情,它似乎對我有用:

 $ git clone https://github.com/tmsblgh/codechecker.git
 Cloning into 'codechecker'...
 remote: Counting objects: 14825, done.        
 remote: Total 14825 (delta 0), reused 0 (delta 0), pack-reused 14825        
 Receiving objects: 100% (14825/14825), 12.57 MiB | 22.70 MiB/s, done.
 Resolving deltas: 100% (10329/10329), done.

 $ cd codechecker/
 /home/nick/tmp/codechecker

 $ git branch
 * master

 $ git remote -v
 origin https://github.com/tmsblgh/codechecker.git (fetch)
 origin https://github.com/tmsblgh/codechecker.git (push)

 $ git checkout -b issue799 origin/issue799 
 Branch issue799 set up to track remote branch iue799 from origin.
 Switched to a new branch 'issue799'

似乎當地的回購沒有origin/issue799

#fetch the branch
git fetch origin issue799

#see if origin/issue799 exists
git branch -a

#if yes
git checkout issue799

#if not, create the local branch from FETCH_HEAD
git checkout -b issue799 FETCH_HEAD

#the next push after you make some new commits
git push -u origin issue799

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM