日々常々

ふつうのプログラマがあたりまえにしたいこと。

Herokuを久々に使ってみようとして

半年前にHerokuを触ってみて以来、長らく放置していたわけですが、久々に触ってみようと…ごっそり忘れてたのでGettingStartedから。


あれ、Toolbeltなんて前ありましたっけ。全く記憶に無いですが、入っていません。とりあえずインストール。
手順通り heroku login と叩いたものの、SSHキーがどーたらとか言って来ない。

irof@xxxxx helloworld (master)$ heroku login
Enter your Heroku credentials.
Email: xxxxxx
Password: 
Authentication successful.

んー?と思いつつ進める。素直に push してみる。

irof@xxxxx helloworld (master)$ git push heroku master
Permission denied (publickey).
fatal: The remote end hung up unexpectedly

だめじゃん……。通常はloginのときにアップするようなんですが、前に登録したのがあったら違っててもお構いなしっぽい。そこは有効かチェックくらいして欲しかった…。

Herokuの管理画面からアップ出来るかなーと見てみたのですが、よくわからず。herokuコマンドにkeysがあったので、きっとこれでしょう。

irof@xxxxx helloworld (master)$ heroku help keys
Usage: heroku keys

 display keys for the current user

 -l, --long  # display extended information for each key

Additional commands, type "heroku help COMMAND" for more details:

  keys:add [KEY]   # add a key for the current user
  keys:clear       # remove all authentication keys from the current user
  keys:remove KEY  # remove a key from the current user

とりあえず keys:add をしてみます。

irof@xxxxx helloworld (master)$ heroku keys:add ~/.ssh/id_rsa.pub
Uploading SSH public key /Users/irof/.ssh/id_rsa.pub

いけたっぽい。これでやっとHerokuが再び使えるようにー。

heroku keys のメモ

heroku keys で登録されているキーの一覧表示。

irof@xxxxx helloworld (master)$ heroku keys
=== 2 keys for [Email]
ssh-rsa XXXXXXXXXX...XXXXXXXXX abc@de.fg
ssh-rsa YYYYYYYYYY...YYYYYYYYY hij@kl.mn


heroku keys:add キーのパス で追加。同じキーは何度addしても増えてくれない。

irof@xxxxx helloworld (master)$ heroku keys:add ~/.ssh/id_rsa.pub
Uploading SSH public key /Users/irof/.ssh/id_rsa.pub

キーを省略したら、.ssh内を検索して何れにする?って聞いてくる。

irof@Airof helloworld (master)$ heroku keys:add
Found the following SSH public keys:
1) id_rsa.xxx.pub
2) id_rsa.pub
Which would you like to use with your Heroku account? 2
Uploading SSH public key /Users/irof/.ssh/id_rsa.pub


heroku keys:remove キー名?で削除。

irof@xxxxx helloworld (master)$ heroku keys:remove hij@kl.mn
Key hij@kl.mn removed.
irof@xxxxx helloworld (master)$ heroku keys
=== 1 keys for [Email]
ssh-rsa XXXXXXXXXX...XXXXXXXXX abc@de.fg

キー名を省略すると全部消えるっぽい。ちょっと危険かも。

irof@xxxxx helloworld (master)$ heroku keys:remove
Key  removed.
irof@xxxxx helloworld (master)$ heroku keys
No keys for [Email]


全消しには heroku keys:clear があるのに…。

irof@xxxxx helloworld (master)$ heroku keys:clear
All keys removed.
irof@xxxxx helloworld (master)$ heroku keys
No keys for [Email]


help見ろって話だ。見てもいまいち判らなかったからメモってるわけだけど。

irof@xxxxx helloworld (master)$ heroku help keys
Usage: heroku keys

 display keys for the current user

 -l, --long  # display extended information for each key

Additional commands, type "heroku help COMMAND" for more details:

  keys:add [KEY]   # add a key for the current user
  keys:clear       # remove all authentication keys from the current user
  keys:remove KEY  # remove a key from the current user