参考リンク
- ddollar/heroku-accounts
- Managing multiple Heroku accounts - pote.to
- herokuコマンドで複数アカウントを使いわける - Sooey
プラグインインストール
heroku plugins:install git://github.com/ddollar/heroku-accounts.git
----------
Installing heroku-accounts... done
----------
Herokuアカウント登録
- firstアカウント
heroku accounts:add first
↑or↓
- 必要な設定、記述の追加、keyの生成などを自動で行う
heroku accounts:add first --auto
- secondアカウント
heroku accounts:add second
↑or↓
heroku accounts:add second --auto
Herokuアカウント切り替え
- アカウント切り替え
# in project root
heroku accounts:set second
- アカウント表示
heroku accounts
----------
second
first
----------
Herokuアカウント設定削除
heroku accounts:remove first
デフォルト設定
heroku accounts:default first
heroku accounts
----------
second
* first
----------
HerokuへのPush時にエラーが出たら
Managing multiple Heroku accounts - pote.to
- エラーメッセージ
! Your account [email protected] does not have access to xxxxx.
!
! SSH Key Fingerprint: 47:95:51:c4:28:3f:6f:32:7b:e9:fb:27:83:db:de:5f
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
- If you already have a pre-existing SSH key with your Heroku account, you’ll see an error message like this:
! Your key with fingerprint xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx is not authorized to access application-name.
fatal: The remote end hung up unexpectedly
- This error happens because your project is no longer using your old SSH key. Let’s remove the old SSH key from Heroku and upload a new one:
heroku keys:clear
# Clears all existing keys (do this if you only have one key, otherwise use $ heroku keys:remove key)
heroku keys:add ~/.ssh/identity.heroku.second.pub
# Uploads your new personal SSH key
heroku accounts:set second
# Sets the account again
That’s it! Heroku Accounts is easy to setup and well worth the effort if you use Heroku frequently.
- HerokuへPush
git push heroku master