Heroku Keyfile

When first running Heroku if you happen to stumble upon this problem have no fear, it’s an easy fix!

Problem

$ heroku keys:add
No ssh public key found in /home/account/.ssh/id_[rd]sa.pub.
You may want to specify the full path to the keyfile.

Solution If it exists find it and run the command pointing to it or create one by running the following command

$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/account/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/account/.ssh/id_rsa.
Your public key has been saved in /home/account/.ssh/id_rsa.pub.
The key fingerprint is:

Also if you’re ever having an issue cloning an existing Heroku app make sure you use the -o argument. Without it I was getting the usual and not very helpful Permission denied (publickey) exception. So yeah, when pulling down an existing app from Heroku run

git clone -o heroku git@heroku.com:appname.git

instead of

git clone heroku git@heroku.com:appname.git

The -o flag sets the remote name to heroku instead of origin, to make it consistent with the remote that the heroku CLI automatically creates.

-Matt

11 May 2011