LoginSignup
13
9

More than 3 years have passed since last update.

【超凡ミス】git push heroku masterしたら「error: failed to push some refs to 'https://git.heroku.com/******.git'」

Posted at

はじめに

ある教材のハンズオンをしてたらエラーが出たので記録しておきます。

※結論:超凡ミスでした

実行コマンドとエラー内容

作成したアプリケーションをHerokuにデプロイしようと以下のコマンドを実行すると

$ git push heroku master
error: src refspec master does not match any
error: failed to push some refs to 'https://git.heroku.com/******.git'

のエラーが...

原因と解決方法

GitHubのメインブランチがmasterではなくmainなのでそれに合わせて以下のコマンドが正解でした。

$ git push heroku main

実行結果

Enumerating objects: 779, done.
Counting objects: 100% (779/779), done.
Delta compression using up to 8 threads
Compressing objects: 100% (718/718), done.
Writing objects: 100% (779/779), 7.83 MiB | 426.00 KiB/s, done.
Total 779 (delta 234), reused 0 (delta 0), pack-reused 0
remote: Compressing source files... done.
remote: Building source:
...
(中略)
...
remote:        https://quiz-laravel-vuejs.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.
To https://git.heroku.com/******.git
 * [new branch]      main -> main

無事pushできました。

さいごに

2020年10月5日にGitHubのデフォルトブランチがmasterからmainに変わりました。

それ以前に作成された教材でHerokuにデプロイする時は

$ git push heroku master

になっているので気をつけてください!

GitHub、これから作成するリポジトリのデフォルトブランチ名が「main」に。「master」から「main」へ変更

13
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
13
9