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

标签 ruby-on-rails git heroku heroku-toolbelt

我创建了一个 Rails 应用程序

$ rails new appname
$ cd appname

我将其初始化为 git 存储库

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

我登录了heroku

$ heroku login
Email: <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="9dfef2efeff8fee9ddf8f0fcf4f1b3fef2f0" rel="noreferrer noopener nofollow">[email protected]</a>
Password (typing will be hidden):

我创建了heroku应用程序

$ heroku create
Creating radiant-bayou-6540... done, stack is cedar
http://radiant-bayou-6540.herokuapp.com/ | <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="27404e53674f4255484c520944484a" rel="noreferrer noopener nofollow">[email protected]</a>:radiant-bayou-6540.git
Git remote heroku added

我尝试推送到heroku

$ git push heroku master
!  Your account <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b7ded9d4d8c5c5d2d4c3f7d2dad6dedb99d4d8da" rel="noreferrer noopener nofollow">[email protected]</a> does not have access to radiant-bayou-6540.

等等什么?我没有使用 [email protected] 登录,我用 [email protected] 登录。我们来看看git

$ git config user.email
<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="593a362b2b3c3a2d193c34383035773a3634" rel="noreferrer noopener nofollow">[email protected]</a>

什么?!为什么heroku 认为我正在使用 [email protected] 登录

最佳答案

Source

您的帐户 SSH key 与您的旧电子邮件绑定(bind)。您必须将其转移到您的新帐户

$ heroku login
Enter your Heroku credentials.
Email: <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b0d9ded3dfc2c2d5d3c4f0d5ddd1d9dc9ed3dfdd" rel="noreferrer noopener nofollow">[email protected]</a>
Password: 

$ heroku keys:remove <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="066f686569747463657246636b676f6a2865696b" rel="noreferrer noopener nofollow">[email protected]</a>

并将其添加到您的新帐户

$ heroku login
Enter your Heroku credentials.
Email: <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b2d1ddc0c0d7d1c6f2d7dfd3dbde9cd1dddf" rel="noreferrer noopener nofollow">[email protected]</a>
Password: 

$ heroku keys:add

如果失败,请尝试重新创建并添加新的 ssh key

关于ruby-on-rails - `git push heroku master` 失败,因为它使用了错误的电子邮件地址,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24519491/

相关文章:

ruby-on-rails - 未触发 Actioncable 超时断开连接

Git 自动检测系统代理设置

heroku - 如何从 DelayedJob 迁移到 Sidekiq

ruby-on-rails - Angular + Rails 应用程序无法在 heroku 上运行 - 无法实例化模块

node.js - 从部署到 Heroku 的 Node 应用程序提供公共(public)文件

ruby-on-rails - 如何从太阳黑子搜索中获取查询时间

ruby-on-rails - Rails、Backbone、PhoneGap、CORS(Access-Control-Allow-Origin 错误不允许)

ruby-on-rails - Heroku Ruby on Rails 升级崩溃

ruby-on-rails - 持续集成建议?

git - 分支显示显示 (master-> origin) 而不仅仅是 (master)