【发布时间】:2015-04-24 04:41:06
【问题描述】:
我已经在我的遥控器上创建了一个新分支,所以我希望这样做:
$ git fetch && git checkout feature/name
但是,我收到此错误:
error: pathspec 'feature/name' did not match any file(s) known to git.
当我自己运行git fetch 时,它不会返回任何内容,我也尝试过git fetch origin,它也不起作用。
git remote 只返回一个名为origin 的遥控器。
我的配置如下所示:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = true
[remote "origin"]
url = removed as it is a private repo
fetch = +refs/heads/staging:refs/remotes/origin/staging
[branch "staging"]
remote = origin
merge = refs/heads/staging
【问题讨论】:
-
你可以使用
git pull -
但是我的分支还不存在。而且我还没有在我的本地仓库中创建分支,并且可能没有远程分支从其分支的原始分支。
-
您的 origin.fetch 行不是 git 默认值。正常是
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/* -
@AndrewC:这就是问题的原因;您应该将其添加为答案。
-
@torek - 这需要更多的工作:) 这个闻起来像复制品。
标签: git git-remote git-fetch