0

I have two heroku accounts one using email abc@gmail.com and one using xyz@gmail.com

previously I deployed a rails app to my xyz@gmail.com account but now I want to deploy to abc@gmail.com account using the same machine. I logged in using my credentials for abc@gmail.com using the following command

heroku login

but when I do a git push it still uses xyz@gmail.com and gives the error message that xyz@gmail.com does not have access to the application's repository.

I have generated the ssh key for account abc@gmail.com and added it to heroku as well so technically it should work but it is not

please help

Syed Daniyal Shah
  • 193
  • 1
  • 2
  • 12

1 Answers1

0

Heroku login is only used for interaction with the CLI - git uses SSH.

You can either:

Add xyz@gmail.com as a collaborator to abc@gmail.com

or

Assuming that abc@gmail.com already has a public/private key uploaded to Heroku edit/Create ~/.ssh/config

Host heroku.abc
    HostName heroku.com
    IdentityFile ~/.ssh/<abc.key>

Update your projects ~/.git/config to use git@heroku.abc:.... in the remote entries.

So that git remote -v shows:

heroku git@heroku.abc:appname.git (fetch) heroku git@heroku.abc:appname.git (push)

So now when you push to the heroku remote SSH will use the key defined on the heroku.abc entry in your ~/.ssh/config

John Beynon
  • 37,398
  • 8
  • 88
  • 97