Search code examples
ruby-on-railsgitherokuheroku-toolbelt

`git push heroku master` fails because it is using the wrong email address


I created a rails app with

$ rails new appname
$ cd appname

I initialized it as a git repo

$ git init
$ git add .
$ git commit -m 'init'

I logged into heroku

$ heroku login
Email: [email protected]
Password (typing will be hidden):

I created the heroku app

$ heroku create
Creating radiant-bayou-6540... done, stack is cedar
http://radiant-bayou-6540.herokuapp.com/ | [email protected]:radiant-bayou-6540.git
Git remote heroku added

I tried to push to heroku

$ git push heroku master
!  Your account [email protected] does not have access to radiant-bayou-6540.

Wait what? I didn't log in with [email protected], I logged in with [email protected]. Let's look at git

$ git config user.email
[email protected]

What?! Why does heroku think I'm logging in with [email protected]


Solution

  • Source

    Your account SSH keys is tied to your old email. You are going to have to transfer it over to your new account

    $ heroku login
    Enter your Heroku credentials.
    Email: [email protected]
    Password: 
    
    $ heroku keys:remove [email protected]
    

    and add it to your new account

    $ heroku login
    Enter your Heroku credentials.
    Email: [email protected]
    Password: 
    
    $ heroku keys:add
    

    Failing that, try recreating and add a new ssh key