2014 年 12 月更新
andorov 向 Heroku 提及 in the comments 宣布“HTTP Git now Generally Available”:
现在默认使用 HTTP Git,heroku create、heroku git:remote 和 heroku git:clone 命令都将您的本地环境配置为使用 HTTP Git。
如果出于任何原因,您想将 SSH Git 与特定应用程序一起使用,只需将 --ssh-git 标志传递给这些命令,例如:
$ heroku create --ssh-git
如果您想在特定机器上始终使用 SSH Git 和 Heroku,您可以添加以下全局配置:
git config --global url.ssh://git@heroku.com/.insteadOf https://git.heroku.com/
HTTP URL 仍将被写入 .git 文件夹,但 Git 会即时重写所有 Heroku HTTP Git URL 以使用 SSH。
请参阅Git documentation 了解详细信息,包括有关如何删除此设置的说明。
原始答案(2014 年 11 月)
文章“This Week I Learned #2”提到:
使用 Heroku 工具带,您可以通过 Git Remote 而不是名称来识别应用程序
这意味着 -r 后跟远程名称,git remote -v 返回一个。
所以请检查您的本地远程git remote -v,并尝试使用该名称(引用您的 heroku 应用被推送的远程仓库)。
看到project example:
创建 Heroku 应用程序仓库并添加 Git 暂存远程,
heroku login # if you haven't already
heroku create --remote staging # within project dir
heroku create --remote production
git remote -v # expect: origin, staging, production
在这里,项目与两个 Heroku 应用程序相关联,一个用于暂存,另一个用于生产。
当 git push 时,指定正确的远程,当使用 heroku 命令时,使用 --remote remote-name 或 -r remote-name 选项来指定部署应该去的应用程序。
要告诉 heroku 命令默认为这个项目暂存,
git config heroku.remote staging