8

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?

Tekkub
  • 30,739
  • 2
  • 30
  • 20
Mellon
  • 37,586
  • 78
  • 186
  • 264
  • you're not doing anything wrong - I'd get in touch with Heroku support. One thing though, this is a Rails app right? – John Beynon Nov 17 '11 at 10:01
  • 1
    Yes, it will be a Rails app. But currently I just created a plain text file to push to heroku for testing purpose. – Mellon Nov 17 '11 at 10:32

8 Answers8

14

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.)

manojlds
  • 290,304
  • 63
  • 469
  • 417
  • @manojids: I thought it used to be true but change, see http://blog.heroku.com/archives/2011/10/3/scala/ ("The sixth official language" – yairchu Nov 17 '11 at 17:24
  • @yairchu Where does it say anything about this in the blog post? – manojlds Nov 17 '11 at 17:27
  • @yairchu - BTW, what did you "think to be true"? – manojlds Nov 17 '11 at 17:35
  • 1
    it doesn't HAVE to be a Rails app but if it isn't Rails then you need to be using the CEDAR stack (heroku create --stack cedar) if you want to be hosting PHP, JAVA, PYTHON etc. – John Beynon Nov 17 '11 at 17:36
  • 1
    @manojids: oops, I missed your parentheses saying "or any of the other supported apps". – yairchu Nov 17 '11 at 17:39
  • @JohnBeynon - My point here being, it has to be some recognized app ( and OP has said that he is doing a Rails app), not some random repo with a dummy HELLO file. Got it? – manojlds Nov 17 '11 at 17:40
  • @manojlds - totally get it - I'd not reloaded/been notified of your editing to add the parantheses and the text there when I wrote my response. – John Beynon Nov 17 '11 at 17:44
5

I was able to solve this error by performing below steps.

  1. git init
  2. git add .
  3. git commit -m "My first commit"
  4. heroku create
  5. git push heroku master
Ankur Devani
  • 59
  • 1
  • 1
1

I have also faced this problem while creating a web resume with ReactJS, when I searched for log file

(which presents at --> dashboard.heroku.com/apps/{your App name}/activity)

, I saw this and Follow steps which are given below. And the issue is resolved.

-----> Node.js app detected

-----> Build failed

! Two different lockfiles found: package-lock.json and yarn.lock Both npm and yarn have created lockfiles for this application, but only one can be used to install dependencies. Installing dependencies using the wrong package manager can result in missing packages or subtle bugs in production.

   - To use npm to install your application's dependencies please delete the yarn.lock file.
     $ git rm yarn.lock
   - To use yarn to install your application's dependences please delete
     the package-lock.json file.
     $ git rm package-lock.json
B4BIPIN
  • 353
  • 2
  • 11
1

If you are using node.js specify in the package.json:

    "engines": {
    "node": "version", (you can check the version by typing "node -v" in your cmd prompt)
  },

under the name and the version definition.

if you are using yarn / npm define also under the engines : "yarn": "version" / "npm" : "version".

in addition add this command on the cmd prompt in your git folder->

 heroku config:set NPM_CONFIG_PRODUCTION=true YARN_PRODUCTION=true
matan yemini
  • 141
  • 2
  • 4
0

I got this same error after I was pushing changes to a separate heroku project in a separate terminal window. The error stopped up after I logged back in to github via the terminal for the project that was giving me the error.

elmeltone
  • 119
  • 1
  • 4
0

When you push your code to Heroku using: git push heroku master:main command it's try to validate the type of your app so, make sure you have added the requirements.py file incase of python and if you want to run to build and run the app, make sure you have included Procfile.

for profile content check the below: https://devcenter.heroku.com/articles/getting-started-with-python#define-a-procfile

You can reset you Heroku repo using below plugin as well: https://devcenter.heroku.com/articles/git

Refer for python Build plan: https://elements.heroku.com/buildpacks/heroku/heroku-buildpack-python

Anbarasan
  • 86
  • 1
  • 4
0

For my problem, I was trying to push streamlit apps and it could be solved by creating the requirements.txt. To initiate the file you could simply just run this code.

pip freeze > requirements.txt

After the file is created re-push the file into GitHub, and finally push it into Heroku.

I hope your problem could be solved.

theDreamer911
  • 85
  • 1
  • 9
-1

I got this error this morning as well and turn out to be service down in Heroku (the app runs fine, but dashboard, deploy are down).

Check http://status.heroku.com first.

I waited a few hours and once their service back to normal, my commit success.

John Pang
  • 2,403
  • 25
  • 25