我创建了一个 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] 登录
最佳答案
您的帐户 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/