Rails 3.2:Heroku推送拒绝,没有检测到Cedar支持的应用程序

时间:2022-05-30 00:14:29

Rails newbie here. I'm trying to deploy my Rails 3.1/Ruby 1.9.3-p0 app to Heroku and have followed all the steps according to Heroku. But I keep running into:

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

Heroku push rejected, no Cedar-supported app detected

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

I've tried all the suggestions in this question but so far unsuccessful.

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

7 个解决方案

#1


74  

I have encountered a similar rejection. What worked for me was reinitializing the .git file.

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

Try in the command line:

尝试在命令行中:

rm -rf .git
git init
git add .
git commit -am "Reinitialize"
heroku create --stack cedar
git push heroku master

#2


8  

I Have just solved this problem with one of my apps. If you check the documentation, the Cedar Stack searches for the Gemfile in the root directory. In my case, the root directory only had the folder containing my app with the Gemfile inside it.

我刚用我的一个应用程序解决了这个问题。如果您查看文档,Cedar Stack将在根目录中搜索Gemfile。在我的例子中,根目录只有包含我的app的文件夹,里面有Gemfile。

So, what you need to do is to initialize a new git repo inside this folder and add the remote:

所以,你需要做的是在这个文件夹中初始化一个新的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

And you're done!

而且你已经完成了!

#3


7  

Whenever I encounter this error, I check the following two things:

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

  • Make sure the Gemfile exist in root directory of Rails application. Heroku use it to determine what type of application to deploy.
  • 确保Gemfile存在于Rails应用程序的根目录中。 Heroku使用它来确定要部署的应用程序类型。
  • Make sure the Rails app root directory itself is put under version control (e.g: Git) rather than its parent directory.
  • 确保Rails应用程序根目录本身置于版本控制之下(例如:Git)而不是其父目录。

If you accidentally put the parent directory of your rails application into version control. Delete the .git directory inside this parent directory and initialize a new repository but this time under the Rails application directory.

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

#4


5  

Try

尝试

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

Then run

然后跑

git push heroku master

#5


3  

I have encountered this issue a few time before and it was because I was trying to push a remote branch to heroku.

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

To solve the problem, instead of using:

要解决问题,而不是使用:

git push heroku master

I used:

我用了:

git push heroku my-branch:master

This pushes the remote branch my-branch in the git repository to the master branch of heroku.

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

#6


0  

I have the same problem. My file structure was not what heroku expected (.git must be on the same level as Gemfile). I removed the Rails_Code folder and it worked.

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

Project\
         .git
         Rails_Code\
                     Gemfile
                     etc...

#7


0  

Same Situation, Like @petwho said above

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

"Make sure the Gemfile exist in root directory of Rails application. Heroku use it to determine what type of application to deploy."

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

In my case, somehow my Gemfiles and Gemfile.lock was being ignored. When I checked on github there was no Gemfile being pushed up with my app due because .gitignore was ignoring my gemfiles.

就我而言,我的Gemfiles和Gemfile.lock被忽略了。当我检查github时,由于.gitignore忽略了我的gemfiles,因此我的应用程序没有推送Gemfile。

After removing my gemfiles from gitignore, I pushed to heroku and everything worked smoothly

从gitignore删除我的gemfiles后,我推到了heroku,一切顺利

#1


74  

I have encountered a similar rejection. What worked for me was reinitializing the .git file.

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

Try in the command line:

尝试在命令行中:

rm -rf .git
git init
git add .
git commit -am "Reinitialize"
heroku create --stack cedar
git push heroku master

#2


8  

I Have just solved this problem with one of my apps. If you check the documentation, the Cedar Stack searches for the Gemfile in the root directory. In my case, the root directory only had the folder containing my app with the Gemfile inside it.

我刚用我的一个应用程序解决了这个问题。如果您查看文档,Cedar Stack将在根目录中搜索Gemfile。在我的例子中,根目录只有包含我的app的文件夹,里面有Gemfile。

So, what you need to do is to initialize a new git repo inside this folder and add the remote:

所以,你需要做的是在这个文件夹中初始化一个新的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

And you're done!

而且你已经完成了!

#3


7  

Whenever I encounter this error, I check the following two things:

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

  • Make sure the Gemfile exist in root directory of Rails application. Heroku use it to determine what type of application to deploy.
  • 确保Gemfile存在于Rails应用程序的根目录中。 Heroku使用它来确定要部署的应用程序类型。
  • Make sure the Rails app root directory itself is put under version control (e.g: Git) rather than its parent directory.
  • 确保Rails应用程序根目录本身置于版本控制之下(例如:Git)而不是其父目录。

If you accidentally put the parent directory of your rails application into version control. Delete the .git directory inside this parent directory and initialize a new repository but this time under the Rails application directory.

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

#4


5  

Try

尝试

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

Then run

然后跑

git push heroku master

#5


3  

I have encountered this issue a few time before and it was because I was trying to push a remote branch to heroku.

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

To solve the problem, instead of using:

要解决问题,而不是使用:

git push heroku master

I used:

我用了:

git push heroku my-branch:master

This pushes the remote branch my-branch in the git repository to the master branch of heroku.

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

#6


0  

I have the same problem. My file structure was not what heroku expected (.git must be on the same level as Gemfile). I removed the Rails_Code folder and it worked.

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

Project\
         .git
         Rails_Code\
                     Gemfile
                     etc...

#7


0  

Same Situation, Like @petwho said above

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

"Make sure the Gemfile exist in root directory of Rails application. Heroku use it to determine what type of application to deploy."

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

In my case, somehow my Gemfiles and Gemfile.lock was being ignored. When I checked on github there was no Gemfile being pushed up with my app due because .gitignore was ignoring my gemfiles.

就我而言,我的Gemfiles和Gemfile.lock被忽略了。当我检查github时,由于.gitignore忽略了我的gemfiles,因此我的应用程序没有推送Gemfile。

After removing my gemfiles from gitignore, I pushed to heroku and everything worked smoothly

从gitignore删除我的gemfiles后,我推到了heroku,一切顺利