6
5

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 5 years have passed since last update.

Permission denied (publickey) が heroku で発生したとき

Posted at

開発マシンのコマンドプロンプトから下記コマンドを実行して、以下のエラーが発生した場合の対処

開発マシン
 OS: Windows 7 Home Premium SP1 x64
 git: git Extensions
 ssh生成: gitbash

C:\> git push heroku master

Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

gitbash で生成したssh鍵を heroku keys:add で追加した後、
ssh鍵が格納されているディレクトリ C:\Users\%USERNAME%\.ssh へ、以下の内容でconfigファイルを作成する。

config
Host heroku.com
 User git
 port 22
 Hostname heroku.com
 IdentityFile ~/.ssh/heroku_rsa
 TCPKeepAlive yes
 IdentitiesOnly yes

※ファイル名はheroku_rsa として作成している。

この状態でローカルマシンのレポジトリの場所まで移動し、git push heroku masterコマンドを実行すると、デプロイに成功した。

6
5
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
6
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?