git - 无法从 GitHub fork 存储库 check out 分支

标签 git github

我试图从我的 fork 存储库中 checkout 一个分支,但它给出了一个错误:

存储库: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.

最佳答案

本地存储库似乎没有 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

关于git - 无法从 GitHub fork 存储库 check out 分支,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50764838/

相关文章:

macos - OSX 上的 SourceTree : Clicking "Always Allow" bitbucket to use my password keychain has no effect

git - 解决 merge 冲突后无法推送

git - Jenkins GitSCM 在特定文件夹中 checkout

git - 如何从 svn 删除 .git 文件?

git - 在 Powershell 中为 Git 分支添加选项卡完成

jenkins - 如何使用作业 dsl 配置基本分支构建策略插件?

git - SmartGit/Hg 4.6.2 Head 未指向有效提交

Github 在等待 pull 请求时在 fork 上工作

git - 如何更新 Jenkins 中所有作业的 git 凭据?

java - 在 Git 中显示特定人员的日志信息