1

I have a repository myrepo but when I try to fetch it, I cannot. This repository exists on Github as well. Fetching origin/myrepo causes an error as well.

Here is the error:

$ 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

Clearly, as per the last command, the directory exists.

Eric Baldwin
  • 3,341
  • 10
  • 31
  • 71

2 Answers2

1

The easiest way is to fetch everything:

git fetch origin

But if you want to fetch only one branch:

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

That is, in your case:

git fetch origin myrepo:refs/remotes/origin/myrepo
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
0

myrepo is just a local branch in your local repository.

Use git remote -v to check what's the remote's name you have.

xdazz
  • 158,678
  • 38
  • 247
  • 274