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

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.