Src refspec master does not match any error when pushing to repository
Platform Notice: Server, Data Center, and Cloud By Request - This article was written for the Atlassian server and data center platforms but may also be useful for Atlassian Cloud customers. If completing instructions in this article would help you, please contact Atlassian Support and mention it.
When pushing a new repository to Bitbucket Server, the following error is returned from the Git client:
git push -u origin master error: src refspec master does not match any. error: failed to push some refs to 'http://stash.company.com/scm/PROJECT/REPO.git'
This is caused by the repository still being empty. There are no commits in the repository and thus no
master branch to push to the server.
Create the first commit inside of the repository and then it can be pushed. For example, the following with create an initial commit and push it to the server.
touch initial git add initial git commit -m "initial commit" git push -u origin master