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

GhostRider picture GhostRider · Apr 23, 2015 · Viewed 10.5k times · Source

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

Answer

VonC picture VonC · Apr 23, 2015

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?".