Git获取不识别远程分支

时间:2013-12-26 06:52:17

标签: git github

我有一个存储库myrepo但是当我尝试获取它时,我不能。此存储库也存在于Github上。获取origin/myrepo也会导致错误。

这是错误:

$ git fetch myrepo
fatal: 'myrepo' 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/myrepo
fatal: 'origin/myrepo' 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 branch
  calendar
  master
* myrepo
  routes

显然,根据最后一个命令,目录存在。

2 个答案:

答案 0 :(得分:0)

myrepo只是本地存储库中的本地分支。

使用git remote -v检查您的遥控器名称是什么。

答案 1 :(得分:0)

最简单的方法是获取所有内容:

git fetch origin

但是如果你想要fetch only one branch

git fetch <remotename> <remote branch>:refs/remotes/<remotename>/<local branch>

就是说,在你的情况下:

git fetch origin myrepo:refs/remotes/origin/myrepo