git push heroku master: Heroku push rejected, no Cedar-supported app detected

前端 未结 12 881
执笔经年
执笔经年 2020-12-14 10:00

I tried running:

$ git push heroku master    
-----

Total 7121 (delta 2300), reused 6879 (delta 2228)
 !     Heroku push rejected, no Cedar-supported app de         


        
相关标签:
12条回答
  • 2020-12-14 10:43

    I struggled with this issue for a long time and the only solution was Vincent van Leeuwen's, but I didn't understand why. The problem turned out to be that I was working from a local branch other than master. So when I was running

    git push heroku master
    

    I was actually pushing

    (local) master->(heroku) master
    

    and not

    (local) current_branch -> (heroku) master
    

    as I intended. This failed because my local master branch didn't have requirements.txt, Procfile, etc.

    The solution is:

    git push heroku current_branch:master
    

    See heroku docs for more.

    Hope this helps.

    0 讨论(0)
  • 2020-12-14 10:45

    My situation is that my codes are needed to save both on Github and Heroku, if I use the following solution, rm -rf .git will delete the connection to my Github, therefore I can't push my codes to Github.

    rm -rf .git
    git init 
    git add .
    git commit -m "First commit"
    heroku create --stack cedar-14
    git push heroku master
    

    Instead, my solution is as follows:

    $ heroku create
    $ heroku config:add BUILDPACK_URL=git://github.com/heroku/heroku-buildpack-python.git
    $ git push heroku master
    
    0 讨论(0)
  • 2020-12-14 10:46

    All the above solutions dont mention that what matters is where is your .git initialised. Actually when you try push on heroku you should be doing it from the directory where you had initialsed the git itself. Also the directory you are uploading should be the one where you have files like

    • requirements.txt, Procfile, virtualenv, manage.py and .gitignore

      etc. In short Heroku needs all files to understand the type of project you want to upload so these files should be accessible on the root directory.

    0 讨论(0)
  • 2020-12-14 10:47

    My stupid error was to mispell requirements.txt as the erroneous requirments.txt. I didn't need setup.py.

    Additionally I need to actually store the git repository in Github. Just creating it locally wasn't enough.

    0 讨论(0)
  • 2020-12-14 10:51

    You need to add the requirement.txt file to git and then push it will work of sure.

    0 讨论(0)
  • 2020-12-14 10:52

    Since Django is a python app, you'll need to have requirements.txt and setup.py sit in the root of your repo and not the src sub-directory. See https://github.com/heroku/heroku-buildpack-python/blob/master/bin/detect

    0 讨论(0)
提交回复
热议问题