FWIW, ran into same error, but believe it came about due to the following sequence of events:
- Remote Git repo was created with
master
branch.
- Local clone was then created.
- Remote Git repo was then modified to include a
dev
branch, which was defined as the default branch, in conjunction with permissions added to the master
branch preventing changes without a pull request.
- Code updates occurred in the local clone, ready to be pushed to the remote repo.
Then, when attempting to push changes from the local to the remote, received error "src refspec master does not match any", or when attempting to push to dev
, "src refspec dev does not match any".
Because changes were pending in the local clone, I did not want to blast it and refresh.
So, fixed the issue by renaming the local branch to dev
...
$ git branch -m dev
...followed by the normal push of git push origin dev
, which worked this time without throwing the aforementioned error.