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


アトラシアン コミュニティをご利用ください。


プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。

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.

*Fisheye および 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.

最終更新日: 2023 年 12 月 5 日


Powered by Confluence and Scroll Viewport.