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 :(
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.
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
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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With