If you want to set up a specific public/private keypair specifically for Heroku, so that you don’t have to use your own Mac OS X userid keypair, the following procedure should work:

1) Create a new keypair named id_heroku and id_heroku.pub

cd ~/.ssh
ssh-keygen -t rsa -C "Keypair for Heroku" -f id_heroku

2) Add the keypair to Heroku

heroku keys:add ./id_heroku.pub

3) Create a ssh config file

vi ~/.ssh/config

In the config file, make sure you have:

Host heroku.com
Hostname heroku.com
Port 22
IdentitiesOnly yes
IdentityFile ~/.ssh/id_heroku
TCPKeepAlive yes
User your_userid

Now when you execute git operations, ssh will use the config file and therefore use the specified IdentityFile for authenticating with heroku.com

1 Response to “A Specific Mac OS X keypair for Heroku ”

  1. Kevin Elliott Says:

    Thanks for this! It confirmed my assumptions about how to setup an alternative key for heroku.

    Although, I use two accounts on heroku (one for personal and one for business), and unfortunately, I can’t seem to find a way to set two different keys for them, and Heroku doesn’t let you use the same key with two accounts.

    Any ideas?

Sorry, comments are closed for this article.