25

Rails 新手在这里。我正在尝试将我的 Rails 3.1/Ruby 1.9.3-p0 应用程序部署到 Heroku,并按照 Heroku 的所有步骤进行操作。但我一直遇到:

Heroku 推送被拒绝,未检测到 Cedar 支持的应用程序

我已经尝试了这个问题中的所有建议,但到目前为止没有成功。

4

7 回答 7

74

我也遇到过类似的拒绝。对我有用的是重新初始化 .git 文件。

在命令行中尝试:

rm -rf .git
git init
git add .
git commit -am "Reinitialize"
heroku create --stack cedar
git push heroku master
于 2012-07-20T00:32:27.307 回答
8

我刚刚用我的一个应用程序解决了这个问题。如果您查看文档,Cedar Stack 会在根目录中搜索 Gemfile 。就我而言,根目录只有包含我的应用程序的文件夹,其中包含 Gemfile。

所以,你需要做的是在这个文件夹中初始化一个新的 git repo 并添加远程:

$ cd my_app_folder
$ git init
$ git add .
$ git commit -m "Heroku commit"
$ git remote add heroku git@heroku.com:my-app-in-heroku.git
$ git push heroku master

你完成了!

于 2013-10-25T11:38:57.570 回答
7

每当遇到此错误时,我都会检查以下两件事:

  • 确保 Gemfile 存在于Rails 应用程序的根目录中。Heroku 使用它来确定要部署的应用程序类型。
  • 确保 Rails 应用程序根目录本身置于版本控制之下(例如:Git),而不是其父目录。

如果您不小心将 Rails 应用程序的父目录放入版本控制中。删除.git这个父目录中的目录并初始化一个新的存储库,但这次是在 Rails 应用程序目录下。

于 2014-09-15T02:25:05.490 回答
5

尝试

$ git init
$ git add .
$ git commit -m "Change to something"

然后运行

git push heroku master
于 2012-02-16T04:34:55.537 回答
3

我之前遇到过这个问题,这是因为我试图将远程分支推送到 heroku。

为了解决这个问题,而不是使用:

git push heroku master

我用了:

git push heroku my-branch:master

my-branch这会将git 存储库中的远程分支推送到masterheroku 的分支。

于 2014-12-22T17:52:26.997 回答
0

同样的情况,就像上面说的@petwho

“确保 Gemfile 存在于 Rails 应用程序的根目录中。Heroku 使用它来确定要部署的应用程序类型。”

就我而言,不知何故我的GemfilesGemfile.lock被忽略了。当我在 github 上检查时,由于.gitignore忽略了我的 gemfile,我的应用程序没有推送 Gemfile。

从 gitignore 中删除我的 gemfile 后,我推送到 heroku,一切顺利

于 2016-01-09T21:10:01.880 回答
0

我也有同样的问题。我的文件结构不是 heroku 所期望的(.git 必须与 Gemfile 处于同一级别)。我删除了 Rails_Code 文件夹,它起作用了。

Project\
         .git
         Rails_Code\
                     Gemfile
                     etc...
于 2015-12-05T18:00:43.333 回答