How to handle multiple heroku accounts with GIT

Following the answer from HERE it is becoming a simple task.

  1. Generate SSH key by using the command:
    ssh-keygen -t rsa -C “your_email@example.com”
  2. Go to ~/.ssh
  3. If you don’t have a config file – create one with name config
  4. Add the following to the newly created config
Host heroku.work
  HostName heroku.com
  IdentityFile ~/.ssh/id_heroku_work_rsa
  IdentitiesOnly yes

id_heroku_work_rsa is the generated ssh key file using the command from as shown HERE:

Go to your project .git folder and find the config file there. Open it and change remote heroku to look like this:

[remote "heroku"]
   url = git@heroku.work:<you_app_git_path>.git

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s