git - 您的带指纹 (..) 的 key 未经授权(协作)

标签 git heroku github key fingerprint

虽然有很多关于此错误的问题,但所有问题都与出现错误的人创建的应用程序有关,并没有帮助解决我的问题。我已被添加为 heroku 应用程序的合作者。当我尝试通过

克隆 heroku 存储库时
git clone git@heroku.com:myapp.git -o heroku

或者如果我从 github 上克隆它所基于的代码并运行

git push heroku master (after doing git add and git commit)

它给我错误消息“您的带指纹的 key (...) 无权访问我的应用程序。”我尝试了 heroku keys:add、heroku keys:clear 和 ssh-keygen 的各种组合。

此应用程序的其他协作者在推送到 heroku 时没有遇到任何问题。

最佳答案

我收到此错误是因为我使用了多个 heroku 帐户:

我想这样做,这样我就可以使用自己的 Heroku 帐户独立“玩”,同时在团队/项目帐户上与其他人协作。

这与多人在团队帐户上协作的 Heroku 概念不同:我希望团队帐户成为协作的应用程序所有者,这样我的个人帐户就可以像其他帐户一样充当权限较低的协作者团队的。只有所有者才能:添加/删除付费插件、删除/重命名应用以及查看发票。

对于多账户支持(例如,您自己的个人 heroku 账户),您需要添加这个记录不太完整的附加组件:

$ heroku 插件:安装 git://github.com/ddollar/heroku-accounts.git

参见:https://github.com/ddollar/heroku-accounts

这就是你的 git SSH 设置最终的样子:

(venv)MacPro:your_project username$ more .git/config
[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
        ignorecase = true
[remote "origin"]
        fetch = +refs/heads/*:refs/remotes/origin/*
        url = ssh://your_username@git.your_org.com/your_project.git
[branch "master"]
        remote = origin
        merge = refs/heads/master
[remote "heroku_kb"]
        url = git@heroku.individual:your_individual_app.git
        fetch = +refs/heads/*:refs/remotes/heroku/*
[remote "heroku_ocp"]
        url = git@heroku.your_project:your_team_app.git
        fetch = +refs/heads/*:refs/remotes/heroku/*
[heroku]
        account = individual

上面的最后三个部分定义了两个独立的 heroku Remote 并指定了哪个是事件的。

heroku-accounts 附加组件通过添加 ~/.ssh/config 条目使所有这些工作正常进行:

Host heroku.individual
  HostName heroku.com
  IdentityFile "/Users/username/.ssh/identity.heroku.individual"
  IdentitiesOnly yes

Host heroku.your_project
  HostName heroku.com
  IdentityFile "/Users/username/.ssh/identity.heroku.your_project"
  IdentitiesOnly yes

如果您不那样将帐户分开,一个 SSH key 会干扰另一个,您将像我一样最终陷入 SSH 困境,享受 google/forum-chasing 一个看起来像这样的错误:

MacPro:your_project username$ git push heroku master

 !  Your key with fingerprint cf:5b:6b:91:d5:71:e8:8b:73:dc:cf:86:56:fd:7a:49 is not authorized to access [insert appname here].

fatal: The remote end hung up unexpectedly

关于git - 您的带指纹 (..) 的 key 未经授权(协作),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10758056/

相关文章:

python - 如何修改/编辑已安装的 anaconda 包

git - IntelliJ - 如何使用不同的 ssh key

ruby-on-rails - 在 Heroku 上上传网站 : Host key verification failed

git - 如何将 git 与 dropbox 和 usb-stick/thumbdrive 一起使用

git - ssh -vT git@github.com kex_exchange_identification : Connection closed by remote host

git - 根据源分支部署到不同的环境

git - 如何在 git merge 提交中列出冲突的文件( parent 双方都有变化的文件)?

ruby-on-rails - 多次部署后的 Heroku Slug 大小

ssl - Heroku 更新 SSL 证书

github - 格里特和 GitHub。 com.googlesource.gerrit.plugins.github.oauth.OAuthFilter