Herokuで「error: failed to push some refs to」エラーが出た場合の解決方法についてまとめました。
【エラー①】error: failed to push some refs to
Herokuで「git push heroku master」を実行すると、以下のエラーが出ることがあります。
$ git push heroku master Enumerating objects: 28, done. Counting objects: 100% (28/28), done. Delta compression using up to 4 threads Writing objects: 100% (18/18), 252.93 KiB | 12.04 MiB/s, done. remote: Building source: remote: remote: To https://git.heroku.com/xxxxxxx.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'https://git.heroku.com/xxxxxxx.git'
これは、「リモートリポジトリの変更をpullし、pushするまでの間に、他からpushがあったりしてリモートが変更されている状況」のときに表示されることが多いです。
「git push heroku master」を中断した場合などによく発生します。
。
この場合は、リモートの変更をマージしてからpushすると解決できる可能性があります。
$ git fetch $ git rebase heroku/master
【エラー②】error: failed to push some refs to
Herokuで「git push heroku master」を実行すると、以下のエラーが出ることがあります。
$ git push heroku master Enumerating objects: 7, done. Counting objects: 100% (7/7), done. Delta compression using up to 8 threads Compressing objects: 100% (4/4), done. Writing objects: 100% (7/7), 1004 bytes | 1004.00 KiB/s, done. Total 7 (delta 0), reused 0 (delta 0), pack-reused 0 remote: Compressing source files... done. remote: Building source: remote: remote: -----> Building on the Heroku-20 stack remote: -----> Determining which buildpack to use for this app remote: -----> Python app detected remote: -----> Using Python version specified in runtime.txt remote: ! Requested runtime (python-3.8.1) is not available for this stack (heroku-20). remote: ! Aborting. More info: https://devcenter.heroku.com/articles/python-support remote: ! Push rejected, failed to compile Python app. remote: remote: ! Push failed remote: Verifying deploy... remote: remote: ! Push rejected to limitless-badlands-17911. remote: To https://git.heroku.com/limitless-badlands-17911.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'https://git.heroku.com/limitless-badlands-17911.git'
これは、Herokuに対応していないPythonのバージョン(3.8.1)を「runtime.txt」で指定していると発生します。
バージョンを対応しているものに変更すれば解消されます。

【C#入門】基礎文法とサンプル集
C#言語の基本文法・使い方をサンプルプログラムのソースコード付きで解説します。
コメント