【问题标题】:Rails & Heroku Git Push Issue with Directory目录的 Rails 和 Heroku Git 推送问题
【发布时间】:2016-11-30 12:19:55
【问题描述】:

这是我的目录树 rails教程/ hello_app

我尝试将 hello rails 应用程序部署到 heroku,但由于 heroku 无法识别 rails 应用程序而失败。所以我不得不将 rails 应用程序的内容移动到根文件夹(在本例中为 rails-tutorial)。然后就成功了。

现在,我想创建一个新应用。当我尝试在根文件夹中创建它时,它显示“无法在另一个目录中初始化新的 Rails 应用程序,请先更改为非 Rails 目录。”

我该怎么办?如果我将所有内容推送到目录中,heroku 将无法将其识别为应用程序。

【问题讨论】:

  • 将您的文件移回hello_app。进入你的目录。 (如果是 linux,cd hello_app)。然后git push heroku 。现在您可以回到rails_tutorial 并创建新应用。
  • 您可以使用类似这样的方式部署子文件夹:coderwall.com/p/ssxp5q/…

标签: ruby-on-rails git heroku c9.io


【解决方案1】:

当您推送到 heroku 时,请确保您位于项目的根目录,这里是 hello_app

在你的情况下rails-tutorial/hello_app,你在文件夹rails-tutorial,你必须移动到hello_app,只需在终端上输入cd hello_app

您不能在另一个应用程序中创建新的 rails 应用程序。移出当前的 rails 项目,并创建其他项目。

在这种情况下。我认为,您应该将项目 hello_app 的所有内容移动到 rails-tutorial 下的文件夹 hello_app 中。他们在rails-tutorial 下创建了新的rails 应用示例new_app

rails-tutorial    
|__ hello_app
    |__app
    |__bin
    |__config
    |__db
    |__etc...

|__ new_app
    |__app
    |__bin
    |__config
    |__db
    |__etc...

【讨论】:

  • 谢谢。这说明了很多。我不知道每个目录都有自己的 git。
猜你喜欢
  • 1970-01-01
  • 2012-12-20
  • 2019-02-14
  • 2020-06-10
  • 2019-04-05
  • 1970-01-01
  • 1970-01-01
  • 2011-11-15
  • 1970-01-01
相关资源
最近更新 更多