Eric Baldwin
Eric Baldwin

Reputation: 3501

Git fetch not recognizing remote branch

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.

Upvotes: 1

Views: 343

Answers (2)

VonC
VonC

Reputation: 1329652

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

Upvotes: 1

xdazz
xdazz

Reputation: 160963

myrepo is just a local branch in your local repository.

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

Upvotes: 0

Related Questions