GhostRider
GhostRider

Reputation: 2170

GIT: fatal: 'master' does not appear to be a git repository

I was pushing my master branch to my GIT repo and go this error

  fatal: 'master' does not appear to be a git repository

On the advice of a stack question I typed

  git remote -v

and got

  heroku    https://git.heroku.com/peaceful-cove-8372.git (fetch)
  heroku    https://git.heroku.com/peaceful-cove-8372.git (push)
  origin    https://github.com/SimonWalsh1000/breathe.git (fetch)
  origin    https://github.com/SimonWalsh1000/breathe.git (push)

I then typed

   simonalice$ git push -u origin master

And it worked but said

   Branch master set up to track remote branch master from origin.

I am very new to GIT and I am not fully sure what has happened. I would be very grateful if someone could explain this sequence to me. I haven't been able to get clear answers. Is my master branch now, the master branch in GIT or is it some clone?

Many thanks

Upvotes: 10

Views: 15371

Answers (2)

Spencer Goff
Spencer Goff

Reputation: 1192

I was getting the same error while doing git pull <branch>, and I fixed it by changing that to git pull origin <branch>.

Upvotes: 8

VonC
VonC

Reputation: 1323403

And it worked but said

Branch master set up to track remote branch master from origin.

Do a git config --local -l

You will see that the local branch master is set to track the upstream branch origin/master

See "Difference between git checkout --track origin/branch and git checkout -b branch origin/branch".

It would be like you did:

git config branch.master.remote origin
git config branch.master.merge refs/heads/branch

The first push needs that upstream information: see "Why do I need to explicitly push a new branch?".

Upvotes: 6

Related Questions