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 and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible


When pushing a new repository to the 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

Please note that recent Bitbucket releases allow customizing the default branch name, as listed in Setting a system-wide default branch name, you can confirm what is the default branch name before executing the push command.

If the resolution does not work, please get in touch with Atlassian Support.

Last modified on Dec 5, 2023

Was this helpful?

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