Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

push rails app to heroku

I am trying to push a rails application to heroku.

When I get to the last step:

git push heroku master

It doesn't work and gives me these errors:

Counting objects: 85, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (74/74), done.
Writing objects: 100% (85/85), 24.38 KiB, done.
Total 85 (delta 23), reused 0 (delta 0)

-----> Heroku receiving push
 !     Heroku push rejected, no Rails or Rack app detected.

error: hooks/pre-receive exited with error code 1
To [email protected]:smooth-dusk-26.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to '[email protected]:smooth-dusk-26.git'

I don't know what I'm doing wrong :(

like image 671
Lilz Avatar asked Dec 29 '09 11:12

Lilz


People also ask

How do I push build to heroku?

To deploy your app to Heroku, use the git push command to push the code from your local repository's main branch to your heroku remote. For example: $ git push heroku main Initializing repository, done.


3 Answers

Here's the answer I got from Heroku and it worked for me (after trying different pg gems, adapters, and everything else on the 10 other posts about this)

1) add the line: gem 'pg' to your Gemfile.

2) Run the command bundle install to install the gem into your bundle.

3) Stage the Gemfile and Gemfile.lock changes: git add Gemfile Gemfile.lock

4) Commit the changes: git commit -m "Install the pg gem"

5) Redeploy to heroku: git push heroku master

like image 125
jstreebin Avatar answered Sep 21 '22 16:09

jstreebin


When you created your Rails application, did you change directory into the directory of the application? You have to perform all the commands from within the application's directory.

rails myapp
cd myapp
like image 39
John Topley Avatar answered Sep 21 '22 16:09

John Topley


I encountered the same errors working through Chapter 1 of Michael Hartl's Rails Tutorial. They were eventually resolved by issuing another git commit command after opening a Heroku account and configuring the SSH keys: git commit -a -m "Heroku recommit"

git push heroku master then succeeded.

like image 3
Robin Coxe Avatar answered Sep 22 '22 16:09

Robin Coxe