【问题标题】:Heroku: account does not have access to appHeroku:帐户无权访问应用程序
【发布时间】:2014-09-27 08:53:22
【问题描述】:

我正在尝试git pull heroku master,但我收到了

 !  Your account email@gmail.com does not have access to app_name.
 !  
 !  SSH Key Fingerprint: 30:02:49:32...

fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

我已经完成heroku login 并成功通过了身份验证。我需要切换帐户,但不知道除了heroku login 之外我还需要做什么。

【问题讨论】:

  • 您添加了 ssh 密钥了吗?

标签: ruby-on-rails git heroku


【解决方案1】:

尝试找到here 的所有有用答案。

对我来说,我有两个不同的 heroku 帐户,每个帐户都与不同的 git 存储库相关联。所以我不得不告诉heroku为每个人使用特定的SSH密钥(显然,不仅仅是第一个可用的,这似乎是默认行为)。对我有用的确切方法是遵循herehere 的步骤。

详情:

创建一个新的 rsa 密钥: 指定您想要的任何电子邮件,并选择一个便于您记住并与特定 heroku 应用关联的名称。或者您可以将其命名为 /id_rsa_herokualt。

$ ssh-keygen -t rsa -C "youremail[at]domain.com" -f  ~/.ssh/id_rsa_myherokuapp

添加到您的机器:确保输入您在上一步中指定的准确文件名。

$ ssh-add ~/.ssh/id_rsa_myherokuapp

添加到 Heroku: 这假设您已经使用 heroku login 登录到 Heroku。

$ heroku keys:add ~/.ssh/id_rsa_myherokuapp.pub

将 heroku.com 的备用主机添加到您的 ~/.ssh/config。 通过转到 Finder 并按 command + shift + g 并输入 ~/.ssh/ 找到此文件。在文本编辑器中打开 Config 文件,添加以下文本,然后保存:

Host heroku-alt
HostName heroku.com
IdentityFile ~/.ssh/id_rsa_myherokuapp

更新项目中的 .git/config 以使用主机别名。 通过转到 Finder 并按 command + shift + g 并输入 ~/path/to/your/ 找到此文件存储库/.git。在文本编辑器中打开 Config 文件,添加以下文本,然后保存:

[remote "heroku"]
  url = git@heroku-alt:myherokuapp.git
  fetch = +refs/heads/*:refs/remotes/heroku/*

说明:通过在特定项目的 .git/config 文件的远程中选择 heroku 和 heroku-alt,您可以管理哪些项目使用哪些凭据。

【讨论】:

    【解决方案2】:

    您在 Heroku 登录中使用的电子邮件必须与您的 heroku 应用程序(在 heroku 网站中)的“访问”选项卡中指定的电子邮件之一匹配。

    同时尝试更改您的 git 电子邮件 (git config --local user.email "email@email.org") 以匹配您在 heroku 登录中使用的电子邮件。

    【讨论】:

      猜你喜欢
      • 2021-08-01
      • 1970-01-01
      • 2014-01-02
      • 1970-01-01
      • 2015-12-11
      • 2012-12-18
      • 2013-04-17
      • 1970-01-01
      • 2017-03-15
      相关资源
      最近更新 更多