git 从github克隆项目。heroku 不起作用

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2294024/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 04:06:15  来源:igfitidea点击:

cloned project from github. heroku does not work

ruby-on-railsgitheroku

提问by ratan

I cloned a project from github over to my desktop. I used to work on it form my laptop.

我从 github 克隆了一个项目到我的桌面。我曾经在我的笔记本电脑上使用它。

However, on laptop heroku does not seem to work for this app eventhough i have it installed.

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

First problem:

第一个问题:

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

I did not have to specify the --appon my laptop. Because I guess I did command heroku createinitially on the lapop.

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

Second Probelm:

第二个问题:

git push heroku master

gives errors

给出错误

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

and heroku list

heroku list

says

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

回答by yfeldblum

First do:

首先做:

git remote add heroku [email protected]:{my-project-name}.git

Where you replace {my-project-name}with the name of the Heroku application as it appears in your Heroku account. For example, if your Heroku account says you have an application named flowing-water-397, then the line would be:

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

git remote add heroku [email protected]:flowing-water-397.git

Then Git and the Heroku gem will know that this Git repo is connected to a Heroku.com application. Then you can do things such as:

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

git push heroku master
heroku open

Finally, learn a little bit more about Git Remotes.

最后,了解更多关于Git Remotes 的信息

回答by Aidan Feldman

In addition to the git remote add ...that @Justice mentioned, I also needed to run

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

git config heroku.remote heroku

(solution found here)

(解决方案在这里找到)

回答by user664833

I believe I get the error No app specified. Run this command from an app folder or specify which app to use with --app when I run any ambiguous heroku commands. Example:

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

heroku logs

It's ambiguous because I have multiple remoterepositories specified in my project's .git/configfile. The solution for me is simply to specify the remote repository. Example:

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

heroku logs --remote staging

In the above line --remote stagingcorresponds to the following in my project's .git/configfile:

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

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

I hope this helps you.. if not, then perhaps it may help someone else!

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

回答by Matt Jensen

When I had this issue it was because I created more than one remote app on heroku.

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

To remove an existing remote app from heroku use:

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

git remote rm heroku

then go back and use heroku create to start the process over using the correct app name heroku gives you.

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

Solution found here: solution

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