0

I have two heroku accounts one using email [email protected] and one using [email protected]

previously I deployed a rails app to my [email protected] account but now I want to deploy to [email protected] account using the same machine. I logged in using my credentials for [email protected] using the following command

heroku login

but when I do a git push it still uses [email protected] and gives the error message that [email protected] does not have access to the application's repository.

I have generated the ssh key for account [email protected] 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 [email protected] as a collaborator to [email protected]

or

Assuming that [email protected] 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 [email protected]:.... in the remote entries.

So that git remote -v shows:

heroku [email protected]:appname.git (fetch) heroku [email protected]: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