简体   繁体   English

`git push heroku master`失败,因为它使用了错误的电子邮件地址

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

I created a rails app with 我创建了一个Rails应用程序

$ rails new appname
$ cd appname

I initialized it as a git repo 我将其初始化为git repo

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

I logged into heroku 我登录了heroku

$ heroku login
Email: correct@email.com
Password (typing will be hidden):

I created the heroku app 我创建了heroku应用

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

I tried to push to heroku 我试图推到heroku

$ git push heroku master
!  Your account incorrect@email.com does not have access to radiant-bayou-6540.

Wait what? 等等什么 I didn't log in with incorrect@email.com, I logged in with correct@email.com. 我没有使用correct@email.com登录,而是使用correct@email.com登录。 Let's look at git 让我们看看git

$ git config user.email
correct@email.com

What?! 什么?! Why does heroku think I'm logging in with wrong@email.com 为什么heroku认为我使用错误的@ email.com登录

Source 资源

Your account SSH keys is tied to your old email. 您的帐户SSH密钥与您的旧电子邮件相关。 You are going to have to transfer it over to your new account 您将不得不将其转移到新帐户

$ heroku login
Enter your Heroku credentials.
Email: incorrect@email.com
Password: 

$ heroku keys:remove incorrect@email.com

and add it to your new account 并将其添加到您的新帐户

$ heroku login
Enter your Heroku credentials.
Email: correct@email.com
Password: 

$ heroku keys:add

Failing that, try recreating and add a new ssh key 如果失败,请尝试重新创建并添加新的ssh密钥

Removing known_hosts entry for ssh should help. 删除ssh的known_hosts条目应该会有所帮助。 For linux and mac it is in the $HOME/.ssh directory 对于Linux和Mac,它位于$ HOME / .ssh目录中

In my case, I simply had to switch to using ssh. 就我而言,我只需要切换到使用ssh。

git config --global url.ssh://git@heroku.com/.insteadOf https://git.heroku.com/

If the heroku remote uses https , git seems to pull the credentials from elsewhere. 如果heroku遥控器使用https ,则git似乎从其他位置提取凭据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM