Overcome Heroku’s “Permission denied publickey” problem
Heroku is awesome on paper (or screencast) but after following the directions it never worked for me. I couldn’t figure out why, and the Heroku discussion forum didn’t have any answers. But I think I’ve finally figured it out. (In the very least, I’ve finally gotten it working, which is the next best thing!)
Heroku (before today) would let me do everything except clone my remote apps to my local machine, which is more convenient, and in some cases essential (as when doing Rails apps with Hobo). Observe this:
$ heroku clone hobocookbook [/Data/Rails] [DrTeeth]
Initialized empty Git repository in /Data/Rails/hobocookbook/.git/
The authenticity of host 'heroku.com (188.8.131.52)' can't be established.
RSA key fingerprint is 8b:48:5e:67:0e:c9:16:47:32:f2:87:0c:1f:c8:60:ad.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'heroku.com,184.108.40.206' (RSA) to the list of known hosts.
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
/usr/local/lib/ruby/gems/1.8/gems/heroku-0.3/bin/../lib/heroku/command_line.rb:37:in `clone': could not clone the app. Is git installed? (RuntimeError)
from /usr/local/lib/ruby/gems/1.8/gems/heroku-0.3/bin/../lib/heroku/command_line.rb:6:in `send'
from /usr/local/lib/ruby/gems/1.8/gems/heroku-0.3/bin/../lib/heroku/command_line.rb:6:in `execute'
from /usr/local/bin/heroku:19:in `load'
If I may cut to the chase…it appears that the Heroku setup process assumes that the public key you give it will be your default or only public key, while in fact I made a key pair just for Heroku. So once I added some details to my
So far as I know, this solution isn’t listed anywhere else on the web, but I found a tiphere that mentioned changing your default public key, which tipped me off as to what the problem was. (Of course now that I know the solution, I could much more effectively Google to see if anyone else has found it–one of the shortcomings of current search technology as a strategy for finding answers. The keywords you really want to use are the ones in the answer, but of course you don’t know those until you know the answer.)
Anyway, I hope this helps the legions of other people out there who would love to use Heroku but can’t because their use case was overlooked by the set up program.Rails, Ruby, Web Development comment below, or link to this permanent URL from your own site.