Git error, can’t push

Asked

Viewed 872 times

5

I went to give a push and this error occurred:

error: src refspec master does not match any.

What is the cause of this? Could someone help me?

  • 1

    Try git push -u origin master

  • Maybe this solution can help you: https://stackoverflow.com/a/7572252/8997852

  • Explaining the git push -u: https://answall.com/a/210655/64969

  • Another possible error is that you may not have locally branch called master. What command did you execute?

  • Can you post the full Git message when you do a "git status" and when you tried to run the above command? If you have sensitive data rip.

1 answer

1

Possible causes for this error:

  • The branch in question there is no. This can occur if you misspell the branch name and try to give a push for her.
  • The branch in question exists but does not exist locally on your machine. To solve, do the checkout to the branch before doing the push.
  • You may have forgotten commit the file before the push. Remembering that in Git, it is not possible to do push of empty directories, which may lead to the same error as well.
  • You did checkout for a commit specific (thus in the way Detached HEAD) and is trying to give a git push. To solve, you can do the checkout back to the branch or git push origin HEAD:nome-branch

Browser other questions tagged

You are not signed in. Login or sign up in order to post.