LoginSignup
0
0

More than 1 year has passed since last update.

githubに反映されない原因を解決した

Posted at

最近週1か2は出勤前の1〜2時間をプログラミングの勉強に充てています。本日も頑張っていきましょう。

今日はcommitしてpushしたはずなのに、githubに反映されないというトラブルを解決したことを記録に残します。

ことの発端はデプロイ時のエラー(デプロイで毎回エラー。。。)です。

terminal
remote:  !     The Ruby version you are trying to install does not exist on this stack.
remote:  !     
remote:  !     You are trying to install ruby-2.6.3 on heroku-22.
remote:  !     
remote:  !     Ruby ruby-2.6.3 is present on the following stacks:
remote:  !     
remote:  !     - heroku-18
remote:  !     
remote:  !     Heroku recommends you use the latest supported Ruby version listed here:
remote:  !     https://devcenter.heroku.com/articles/ruby-support#supported-runtimes
remote:  !     
remote:  !     For more information on syntax for declaring a Ruby version see:
remote:  !     https://devcenter.heroku.com/articles/ruby-versions
remote:  !

これはエラー分だけみると、「ruby2.6.3はheroku-18にしか対応してませんよ」的なものだと思いますが、
僕はGemfile内のrubyのバージョン指定を外していたので、このエラーが出るのは想定外でした。

で、Gemfileを確認してみると、、、更新されている。。。
次にgithubを確認してみると、、、更新されてない!!

色々調べたもののよく分からず、「git status」で状況確認をすることに。すると

terminal
$ git status
On branch master
Your branch is up to date with 'origin/master'.

Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

        modified:   Gemfile
        modified:   Gemfile.lock
        modified:   app/controllers/application_controller.rb
        modified:   config/routes.rb

pushしても「up to date」と出ているのに、commitが残っているではないか。。。(理解あってますか?)

そこで、試しにここに書いてある「git reset」を実行。

terminal
$ git reset
Unstaged changes after reset:
M       Gemfile
M       Gemfile.lock
M       app/controllers/application_controller.rb
M       config/routes.rb

元に戻せたっぽい。ということでもう一回commitし直し、
そしてpushしてみたところ、うまく行きました!
無事デプロイできたのでチュートリアルの続きやってきます。

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