Wednesday, 28 August 2013

Using multiple heroku accounts

Managing multiple heroku accounts can be difficult as each account requires a unique ssh key ,

To generate unique ssh key for each account use the following steps:
1. create a ssh key by  $ssh-keygen -t rsa -C "youremailid@provider.com" -f  ~/.ssh/unique_name

here youremailid@provider.com is the email id used for heroku account 

you may be asked to enter a passphrase , passphrase is something like a password for the ssh key.

2.Add this key to your server by    $ ssh-add ~/.ssh/unique_name

3. Login to your heroku 

4. then  use,  $ heroku  keys:add 

It will then indicate the list of keys available in the system, as

Found the following SSH public keys:
1) xxxx.pub
2) xxxx.pub
etc
select by indicating the number 1 or 2

You are done.


Now you have authenticated the email id. To allow usage git repository from your system create a new user by $adduser username
and provide a password for the same.

switch to the new user by $su username

then create a ssh key by  $ ssh-keygen -t rsa   


once the key is created , get the public key by using $ cat /path/.ssh/id_rsa.pub

login to your heroku account from a browser and click account, its top left beside the gravatar.

in your account you have an option to add ssh key, copy paste the key generated there.


Once done, whenever you want to push your git repo to heroku thats before $git push heroku master

switch user $su username

then try pushing it . Thus you can manage multiple account wherin a new user for different email is needed.

No comments:

Post a Comment