heroku用の公開鍵を生成・登録
herokuにデプロイしようとしたら次のエラーメッセージが。
Permission denied (publickey).fatal: The remote end hung up unexpectedly.
github用に作ったものとは別にheroku用の公開鍵を作成・登録しないといけない。
鍵の生成
$ ssh-keygen -t rsa
パスは/Users/ユーザー名/.ssh/id_rsa_herokuを指定。
このディレクトリにid_rsa_heroku.pubとid_rsa_herokuが生成されます。
秘密鍵をリストに登録
秘密鍵をリストに登録。
$ ssh-add ~/.ssh/id_rsa_heroku
config設定
その後~/.ssh/configを以下のように設定。
Host heroku User git HostName heroku.com IdentityFile ~/.ssh/id_rsa_heroku Port 22 TCPKeepAlive yes IdentitiesOnly yes
参照サイトはこちら。