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-recei开发者_如何学编程ve exited with error code 1
To git@heroku.com:smooth-dusk-26.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:smooth-dusk-26.git'
I don't know what I'm doing wrong :(
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.
I just had the same problem trying to push my app to heroku and none of the above answers fixed it.
I solved the issue by emptying my RVM Gemset with rvm gemset empty
, deleting my Gemfile.lock (probably best to just rename it) and reinstalling my gems. Pushing worked fine after this.
For me it was the presence of index.php that fixed it. Heroku seems to check for existence of index.php on pre-commit.
Got the same problem under windows following one of the guides on ror site. After making everything like here http://devcenter.heroku.com/articles/quickstart it was solved.
Seems like problem was because of missing two lines.
cd myapp
git init
Also, if you're on Rails 3.0 make sure you use the cedar stack
heroku create --stack cedar
I went through the Rails Tutorial and didn't have a single problem with Heroku (MAC OS X), but you do have to follow the directions.
First, make sure you add/commit to Git. Then if you're in a -b (branch) you need to checkout into master, then merge the branch. If you've made changes to assets, you need to rake asset:precompile.
If you're having a rack up issue, make sure you have this file => config.ru and the contents should look like this.
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
run SampleApp::Application
I'm relatively new to Rails and Heroku, but as I mentioned above, if you're following the tutorial's directions, Heroku is a snap and the directions most definitely work. If not, I highly recommend getting started there!
enter link description here
精彩评论