0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

heroku Method Not Allowed

Last updated at Posted at 2021-01-22

Rails-Tutorial

rails-tutorialのherokuにデプロイするところで躓きました。

開発環境
AWS cloud9


実行したこと

ec2-user:~/environment/hello_app (master) $ heroku keys:add
? Which SSH key would you like to upload? /home/ec2-user/.ssh/id_rsa.pub
Uploading /home/ec2-user/.ssh/id_rsa.pub SSH key... done
ec2-user:~/environment/hello_app (master) $ heroku create                         
Creating app... done, ⬢ shrouded-beach-44231
https://shrouded-beach-44231.herokuapp.com/ | https://git.heroku.com/shrouded-beach-44231.git
ec2-user:~/environment/hello_app (master) $ git push heroku master
error: src refspec master does not match any.
error: failed to push some refs to 'https://git.heroku.com/frozen-citadel-28797.git'

rails-tutorialの手順通りに進めたつもりだったが
途中でSSH鍵間違えたり、heroku createを2回やったりでうまくいかなかった。


解決方法

・まず、herokuにログインして度重なるheroku createで作ってしまった不要なアプリを削除。
.新しく $ heroku create
・git remote -vでURLを確認したらぐちゃぐちゃだったので$ git remote set-url heroku <URL>で住所変更。
・次に、git addもcommitもpushもしていないといけないことを知り、コマンド実行
1 $ git init
2 $ git add -A 例:送りたい荷物を決める
3$ git commit -m "first commit" 例:送りたい荷物の梱包
4$ git push -u origin master 例:荷物の発送

という感じでやってみました。

その後herokuをpush

$ git push heroku master

最後に $ heroku open でデプロイできているか確認。


補足

heroku createの前に

$ heroku login --interactive
$ heroku keys:add
以上をする必要もあるみたいです。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?