I\'m having trouble when working with multiple Heroku accounts on my computer.
The thing is that it\'s worked great before by switching accounts with the heroku gem.
I solved this by using the heroku-accounts plugin
see here for instructions
http://martyhaught.com/articles/2010/12/14/managing-multiple-heroku-accounts/
Install Heroku-accounts plugin and configure it!!
heroku plugins:install heroku-accounts
To add accounts:
$ heroku accounts:add personal
Enter your Heroku credentials.
Email: david@heroku.com
Password: ******
To list accounts:
$ heroku accounts
* personal
work
To switch to a different account:
heroku accounts:set personal
To find current account:
$ heroku accounts:current
personal
To remove an account:
$ heroku accounts:remove personal
Account removed: personal
set to your working heroku account and push the changes.
This has been bugging me for a while, and I never found a solution that I liked. Finally found one.
(OS X specific answer.)
You can just create new users. Go to System Preferences -> Users & Groups -> Add user or group button. You can create a few users for different heroku accounts, I just named mine user1, user2, etc.
Then go to System Preferences -> Sharing -> Remote Login -> Allow access for: All Users
At this point, you can go to a terminal and do the following:
$ ssh user1@localhost
Then you can do things like this:
$ heroku login
$ heroku keys:add
create new public/private key for new email as follows
1) ssh-keygen -t rsa -C "mvjohn@klairvoynat.com"
2) provide new file name in which to save the key (/home/.ssh/seckey)
3) Then add your new key to the ssh-agent:- ssh-add ~/.ssh/seckey
4) Then add your new key to heroku :- heroku keys:add ~/.ssh/seckey
5) add SSH Config File as ~/.ssh/config and content as follows
Host heroku.com Hostname heroku.com Port 22 IdentitiesOnly yes IdentityFile ~/.ssh/seckey User mvjohn@klairvoynat.com
Host heroku.com Hostname heroku.com Port 22 IdentitiesOnly yes IdentityFile ~/.ssh/id_rsa User mvjohn@hotmail.com
6) clone the code using either
a) git clone git@heroku.com:your-application.git b) heroku git:clone -a your-application
You need to ensure that you are using the correct ssh key.
The way to do this (and the way the heroku accounts plugin prompts you) is to add a section to your ssh config file in ~/.ssh/config. For instance, for my work heroku account I have this in my ssh config:
Host heroku.work
HostName heroku.com
IdentityFile ~/.ssh/id_heroku_work_rsa
IdentitiesOnly yes
Now, and this is crucial, you need to make sure that your git remote is set up to use that same named host. In this case it is heroku.work. Normally it would be heroku.com if you were using heroku with only a single account.
So you'll need to edit the git remote (you can do this in the .git/config
file of your repo on your machine). Change the file to look like:
[remote "heroku"]
url = git@heroku.work:<appname>.git
Note the heroku.work, not heroku.com, and replace <appname> with the name of your app (aka your repo name) on heroku.
Edit your config for that project, setting the correct email. From the root of that repository, git config user.email <heroku email>