Heroku 'Permission denied (publickey) fatal: Could not read from remote repository' woes Ask Question

Heroku 'Permission denied (publickey) fatal: Could not read from remote repository' woes Ask Question

I've searched around for many hours on end looking to a solution to my seemingly easy-to-fix problem. It's not that my search turned up nothing, it's that my search turned up so many different solutions -none of which have worked.

Anyways, I am simply unable to push, pull, or fetch from my Heroku repository from my Mac. Every attempt gives me (as if it's mocking me) the following error:

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

I've tried (and re-tried) to fix it in many different ways. As I've said, I've spent a good chunk of the last two days searching around for an answer. Here are some of the things I've tried:

  • heroku keys:clear followed by heroku keys:add
  • Regenerating an ssh key on my own with 'ssh-keygen -t rsa'
  • Clearing out my .ssh directory, followed by heroku keys:clear, followed by generating an ssh key
  • Deleting my app on heroku and recreating one (fortunately not much was on there)

I can fetch from my GitHub repository fine, so I know it's not network connectivity (pinging heroku also works).

As a makeshift solution (that I hope doesn't turn into a permanent one), I've logged in to my Ubuntu Amazon AWS ec2 instance. Pulling and pushing to and from Heroku works perfectly. For this reason, I still feel as if the problem lies with the ssh key on my Mac. Both keys show up under my Heroku account. Does the email address at the end of the key matter?

EDIT: I can push and pull from GitHub fine (I'm not using ssh, however), so why not Heroku?

At this point I'm willing to try anything. Thanks!

ベストアンサー1

この質問にはすでに回答があることは承知しています。しかし、将来的に他の人の役に立つかもしれないので、私の解決策を追加したいと思います。

一般的なキー エラーは次のとおりです: 。 を使用してHeroku に新しいキーを通知することPermission denied (publickey)で、このエラーを修正できます。keys:add

簡単に言うと、次の手順に従ってください。https://devcenter.heroku.com/articles/keys

まず、キーがない場合はキーを作成する必要があります。

ssh-keygen -t rsa

次に、Heroku にキーを追加する必要があります。

heroku keys:add

おすすめ記事