Error when pushing to repository: Src refspec master does not match any

Still need help?

The Atlassian Community is here for you.

Ask the community

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 ''


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

Last modified on Aug 31, 2022

Was this helpful?

Provide feedback about this article
Powered by Confluence and Scroll Viewport.