By alexmoreno, 9 April, 2018

Everything starts with a problem trying to checkout your repository master branch:

git checkout master
error: pathspec 'master' did not match any file(s) known to git.

Trying to checkout origin does not improve things, but at least is a step forward:

git checkout origin/master
Note: checking out 'origin/master'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

HEAD is now at d1389fef9... Merge pull request #4

Now, problem, your master branch is detached in your local.

Solution, create a new branch from that state:

git checkout -b temp

And point master to that new branch

git branch -f master temp

Now you can push to your origin branch to update also in github or your remote repository.

categorias