git - Heroku:您的帐户 example@email.com 无权访问 <app-name>

标签 git heroku ruby-on-rails-4

我无法将代码推送到 Heroku。我有一个帐户,但我忘记了密码。我创建了一个新帐户并尝试使用它进行推送,但现在它向我显示此错误:

Your account someoneelse@gmail.com does not have access to
! SSH Key Fingerprint: 

如何使用新帐户登录?我想用新帐户删除此错误消息。我已将最新的 ssh key 上传到 heroku。我已尽一切努力在 heroku 上推送代码(基本设置),但我无法克服此错误。


您帐户中的任何应用程序都有两个 ssh key ,您应该删除一个不在“~/.ssh/”文件夹中的 key ,或者按照以下步骤操作。

解决方法如下:

  1. 转到 www.heroku.com并使用引发错误的帐户登录。

  2. 转到应用程序设置。 (例如,对于名为“rails-demo”的应用程序,转到 rails-demo 设置并检查是否有两个 ssh key )

  3. 删除系统中不再存在的 key

  4. 或者您可以删除它们,然后使用这些命令生成新的。

    -> ssh-keygen -t rsa

    -> heroku keys:add

  5. 上传新的然后在你的控制台输入

    -> heroku登录

  6. 使用您的帐户登录,然后将其推送到您的应用。

  7. 现在已经解决了。

最佳答案

你需要:

确保your ~/.ssh/config file has an 'myNewAccount' entry

Host heroku.myNewAccount
  HostName heroku.com
  IdentityFile ~/.ssh/id_heroku_myNewAccount_rsa
  IdentitiesOnly yes

然后更改远程“来源”url:

git remote set-url origin git@heroku.myNewAccount:<appname>.git

或者,作为 Ian Vaughan comments below

origin is normally heroku when using the 'heroku-toolbelt':

git remote set-url heroku git@heroku.myNewAccount:<appname>.git

最后一步将确保 git push 将使用您的新帐户,而不是旧帐户。

在“Multiple heroku accounts”中查看更多信息。


如果在配置文件中添加“User git”,则可以删除凭据用户名“git”:

Host heroku.myNewAccount
  User git
  HostName heroku.com
  IdentityFile ~/.ssh/id_heroku_myNewAccount_rsa
  IdentitiesOnly yes

这意味着您可以使用:

git remote set-url origin heroku.myNewAccount:<appname>.git
# or
git remote set-url heroku heroku.myNewAccount:<appname>.git

关于git - Heroku:您的帐户 example@email.com 无权访问 <app-name>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20586992/

相关文章:

git - Git 是否有调试或详细选项来解释它在做什么?

git - 在 Git 分支名称中使用斜杠字符

git - 将 master 恢复到旧提交,同时保留提交

ruby-on-rails - 如何在 Heroku 上的自定义域上使用 HTTPS?

node.js - Angular2 和 Spring Boot。如何服务前端?

maven - 在 Heroku 上部署 Vaadin 14 应用程序时出现问题

ruby-on-rails - 以数组为根对象的 rails 中的强参数

git - "openssl"] 不是有效的属性名称 : . git/info/attributes:5

ruby-on-rails - Rails 4 在服务对象中包含 Helper

ruby-on-rails - 在 Activeadmin 中救援 RecordNotFound