LoginSignup
0
1

More than 3 years have passed since last update.

! [rejected] Heroku に Push できなかった問題

Posted at
git heroku push

すると
こんなエラー

To https://git.heroku.com/~~.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://git.heroku.com/~~.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

しらべたところ

heroku 側のcommit履歴?とローカル側の履歴が違うためだったとすいそく

git rebase heroku/master 

して Heroku のブランチの先端?をローカルの先端に置き換えた?

そして

git push heroku

で無事pushできた。

リモートリポジトリとローカルがべつのものに変わった?ぽいので

git pull したがエラー

fatal: refusing to merge unrelated histories

これで解決?した

git merge --allow-unrelated-histories origin/master

この後,heroku run rails db:migrateなどして

ブラウザからアプリに接続、、、できない!

原因は、アプリいったん止めるコマンドかと思い

heroku restart

しかし変わらず
今度は
https://qiita.com/rebi/items/efd1c36f0a9e46222d80
を参考に

heroku ps:scale web=1

でいけた!

0
1
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
0
1