36

我将一个项目从 github 克隆到我的桌面。我曾经在我的笔记本电脑上工作过。

然而,在笔记本电脑上 heroku 似乎不适用于这个应用程序,即使我已经安装了它。

第一个问题:

heroku open
>No app specified.
>Run this command from app folder or set it adding --app <app name>

我不必--app在我的笔记本电脑上指定。因为我想我heroku create最初是在膝上型电脑上指挥的。

第二个问题:

git push heroku master

给出错误

fatal: 'heroku' does not appear to be a git repository
fatal: The remote end hung up unexpectedly

heroku list

 !   This version of the heroku gem has been deprecated.
 !   Please update it by running: gem update heroku
4

4 回答 4

71

首先做:

git remote add heroku git@heroku.com:{my-project-name}.git

替换{my-project-name}为出现在您的 Heroku 帐户中的 Heroku 应用程序的名称。例如,如果您的 Heroku 帐户显示您有一个名为 的应用程序flowing-water-397,那么该行将是:

git remote add heroku git@heroku.com:flowing-water-397.git

然后 Git 和 Heroku gem 将知道这个 Git 存储库连接到 Heroku.com 应用程序。然后您可以执行以下操作:

git push heroku master
heroku open

最后,进一步了解Git Remotes

于 2010-02-19T04:21:48.283 回答
9

除了git remote add ...@Justice 提到的那个,我还需要运行

git config heroku.remote heroku

(在这里找到的解决方案)

于 2011-09-05T09:03:10.937 回答
4

我相信我收到错误未指定应用程序。当我运行任何模棱两可的 heroku 命令时,从应用程序文件夹运行此命令或指定与 --app 一起使用的应用程序。例子:

heroku logs

这是模棱两可的,因为我在项目文件中指定了多个远程存储库。.git/config我的解决方案是简单地指定远程存储库。例子:

heroku logs --remote staging

上面的行--remote staging对应于我项目.git/config文件中的以下内容:

[remote "staging"]
    url = git@heroku.accountname:foo-bar-1234.git
    fetch = +refs/heads/*:refs/remotes/staging/*

我希望这可以帮助你..如果没有,那么也许它可以帮助别人!

于 2012-04-25T20:09:26.673 回答
2

当我遇到这个问题时,是因为我在 heroku 上创建了多个远程应用程序。

要从 heroku 中删除现有的远程应用程序,请使用:

git remote rm heroku

然后返回并使用 heroku create 重新使用 heroku 为您提供的正确应用程序名称开始该过程。

在这里找到的解决方案: 解决方案

于 2012-03-14T23:06:26.093 回答