无法签出远程git分支 [英] cannot checkout remote git branch
问题描述
我在github本地克隆中。以下是分支机构的列表:
$ git branch -a
* master
online-demo
遥控器/原点/ HEAD->原始/主
远程/源/开发
远程/源/ gh页面
远程/源/主
远程/源/在线演示
远程/ pateketrueke / develop
遥控器/ pateketrueke / gh-pages
遥控器/ pateketrueke / master
当我尝试签出远程分支时,出现错误:
$ git checkout开发
错误:pathspec 'develop'与git已知的任何文件都不匹配。
我不知道这是哪里来的。我想我已经进行了这么多年的结帐了。也许我想念一些东西。无论如何,我做了 git fetch
, git fetch origin
和 git pull
因为我的想法用尽了,仍然存在相同的错误。
您没有任何本地分支称为 您可以使用以下格式对其进行更明确的显示: 或 取决于您想要的内容。 这些可以缩写为: 或 I'm in a github local clone. Below is the list of branches: When I try to checkout a remote branch, I get an error: I can't figure out where does that come from. I guess I've been doing such checkouts for ages. Maybe I'm missing something. Anyway, I did You don't have any local branch called You can be more explicit about it by using the following form: or depending on what you want. These can be abbreviated as: or
这篇关于无法签出远程git分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! develop
。当执行 git checkout开发
且未找到本地分支时,git会理解您想创建一个名为 develop $ c $的新本地分支c>,基于远程存储库中的
develop
分支(如果存在)。在您的情况下,您有2个这样的分支 origin / develop
和 pateketrueke / develop
,所以存在歧义。 / p>
git分支开发原点/开发
git结帐开发
git分支开发pateketrueke / develop
git checkout开发
git checkout -b开发来源/开发
git checkout -b开发pateketrueke / develop
$ git branch -a
* master
online-demo
remotes/origin/HEAD -> origin/master
remotes/origin/develop
remotes/origin/gh-pages
remotes/origin/master
remotes/origin/online-demo
remotes/pateketrueke/develop
remotes/pateketrueke/gh-pages
remotes/pateketrueke/master
$ git checkout develop
error: pathspec 'develop' did not match any file(s) known to git.
git fetch
, git fetch origin
and git pull
because I'm running out of ideas and there's still the same error.develop
. When doing git checkout develop
and no local branches are found, git will understand that you want to make a new local branch called develop
, based on a develop
branch in a remote repo, if any exists. In your case, you have 2 such branches origin/develop
and pateketrueke/develop
, so there is an ambiguity.git branch develop origin/develop
git checkout develop
git branch develop pateketrueke/develop
git checkout develop
git checkout -b develop origin/develop
git checkout -b develop pateketrueke/develop