我收到此错误是因为我使用了多个 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 遥控器并指定哪个是活动的。
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 密钥会干扰另一个,你最终会像我一样陷入 SSH 困境,在谷歌/论坛中寻找一个看起来像这样的错误:
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