Herokuで"No account specified."と言われloginできない
Herokuにログインできない問題の解決についてです。
Herokuにloginできない
https://devcenter.heroku.com/articles/quickstart
ここを見ながら進めていました。大雑把に言うと
- 1, Herokuにsign up
- 2, メールのリンクからactivate
- 3, Heroku Toolbeltをインストール
- 4, login&公開鍵の送信
この流れで使えるようになる予定でした。
この4の段階で、下記エラーが
$ heroku login
Enter your Heroku credentials.
Email: MAIL
Password (typing will be hidden):
! No account specified.
!
! Run this command with --account <account name>
!
! You can also add it as a git config attribute with:
! git config heroku.account work
Enter your Heroku credentials.
Email: MAIL
Password (typing will be hidden):
! No account specified.
!
! Run this command with --account <account name>
!
! You can also add it as a git config attribute with:
! git config heroku.account work
3の段階はHeroku Toolbeltのインストールではなく、gitはhomebrew、foremanとherokuはgemで入れてある、という状況でした。
$ gem list
:
foreman (0.46.0)
:
heroku (2.26.2)
因果関係の検討はつきませんが、これが原因なのかもしれません。
:
foreman (0.46.0)
:
heroku (2.26.2)
heroku-accountsプラグインによる解決
heroku-accountsプラグインをインストールし、アカウントを作ったところ、loginできました。
$ heroku login
Enter your Heroku credentials.
Email: mail
Password (typing will be hidden):
Authentication successful.
Enter your Heroku credentials.
Email: mail
Password (typing will be hidden):
Authentication successful.
手順
プラグインをインストール
$ heroku plugins:install git://github.com/ddollar/heroku-accounts.git
heroku-accounts installed
heroku-accounts installed
任意のアカウントを作成
$ heroku accounts:add NAME
Enter your Heroku credentials.
Email: MAIL
Password (typing will be hidden):
Add the following to your ~/.ssh/config
Host heroku.NAME
HostName heroku.com
IdentityFile /PATH/TO/PRIVATE/KEY
IdentitiesOnly yes
Enter your Heroku credentials.
Email: MAIL
Password (typing will be hidden):
Add the following to your ~/.ssh/config
Host heroku.NAME
HostName heroku.com
IdentityFile /PATH/TO/PRIVATE/KEY
IdentitiesOnly yes
Add the followingの部分を記載
作ったアカウントをデフォルトに
$ heroku accounts:default NAME
アカウントを確認。*印がデフォルトアカウント
$ heroku accounts
* NAME
* NAME
これでloginすればいけるはずです。僕は公開鍵を送信してからloginしました。
$ heroku keys:add /PATH_TO_KEY/PUBKEY.pub
Uploading SSH public key /PATH_TO_KEY/PUBKEY.pub... done
$ heroku login
Uploading SSH public key /PATH_TO_KEY/PUBKEY.pub... done
$ heroku login
本来heroku-accountsは複数アカウント管理用のプラグインみたいです。根本解決ではありませんが、一応参考まで。
なお、エラー文言にある--account accountnameをつけてloginやgit configのやり方は、色々な形式で試行錯誤しましたがうまく行きませんでした。