Git error: src refspec master does not match any error: failed to push some refs [duplicate]

One classic root cause for this message is:

  • when the repo has been initialized (git init lis4368/assignments),
  • but no commit has ever been made

Ie, if you don’t have added and committed at least once, there won’t be a local master branch to push to.

Try first to create a commit:

  • either by adding (git add .) then git commit -m "first commit"
    (assuming you have the right files in place to add to the index)
  • or by create a first empty commit: git commit --allow-empty -m "Initial empty commit"

And then try git push -u origin master again.

See “Why do I need to explicitly push a new branch?” for more.

Leave a Comment