Error when pushing to repository: Src refspec master does not match any
プラットフォームについて: Server、Data Center、および Cloud (状況に応じる) - この記事はアトラシアンの Server および Data Center プラットフォーム向けに記述されていますが、Atlassian Cloud のカスタマーも記事の内容を利用できる可能性があります。この記事で説明されている手順の実施が役立つと考えられる場合、アトラシアン サポートにお問い合わせのうえ、この記事について言及してください。
問題
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