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. But now (even though I've generated new SSH keys) it wont work.
When I do a git push heroku master
it just says:
[email protected] not authorized to access my_app_name
Does anyone have any advice on how I could solve this?
How can I login using a different account, after the "heroku login" command? You have to create a new profile in your browser, log in to heroku.com and save the password, make sure the browser you're using is your default browser, make sure it's the only open browser window, and run heroku login .
Go to Github and under your personal settings revoke access BUT THEN go back to Heroku, logout, login and you will see a warning from Heroku on the dashboard saying that access has been revoked from your GitHub account. Click on Disconnect on that app. Then reauthorize the others.
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 = [email protected]:<appname>.git
Note the heroku.work, not heroku.com, and replace <appname> with the name of your app (aka your repo name) on heroku.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With