Mellon Mellon - 10 days ago 6
Git Question

Newbie in Heroku: Error when push my app to Heroku

I am using Ubuntu 10.04. By following the tutorial here, I have created Heroku account, installed GIT and Heroku successfully. I have uploaded the SSH key and add heroku to my system PATH.

After that, I did the following thing:

---------- FIRST (successful)-------------

$ cd PATH/TO/MY_APP
$ git init
Initialized empty Git repository in .git/
$ touch HELLO
$ git add .
$ git commit -m "Add a HELLO file"


------------THEN (successful)----------

$ heroku create
Enter your Heroku credentials.
Email: joe@domain.com
Password:
Uploading ssh public key /Users/joe/.ssh/id_rsa.pub
Created http://high-sunrise-58.heroku.com/ | git@heroku.com:high-sunrise-58.git
Git remote heroku added


----------- LAST (Which failed!!!)----------

$ git push heroku master

Warning: Permanently added the RSA host key for IP address 'xx.xx.xx.xx' to the list of known hosts.
Counting objects: 3, done.
Writing objects: 100% (3/3), 226 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
f
-----> Heroku receiving push

! Heroku push rejected due to an unrecognized error.
! We've been notified, see http://support.heroku.com if the problem persists.


To git@heroku.com:high-sunrise-58.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:high-sunrise-58.git'


As you see above, my LAST step failed.

What could be the possible reason for the error in my LAST step(when push my app to Heroku)?Why it is failed?

Answer

You cannot push any random repo to Heroku. It has to be a rails app ( or any of the other supported apps like Django, but in this case OP is working on Rails) and that is what the pre-receive hook is rejecting in your case since your repo just has some dummy file. ( NOTE that the first step in the tutorial is not creating an empty git repo, but creating one for your Rails app. See the output in the successful push example in the quickstart - Rails app detected - means it looks for the rails app when you push something.)