Git push heroku master ------> ! [remote rejected] master -> master (pre-receive hook declined)


#1

I’ve been working on this for hours to no avail. I’m at the beginning part of the Heroku deployment. Every time I try to push my code to the Heroku master, I get the follow error:

! [remote rejected] master -> master (pre-receive hook declined)

The full text of the last version is here:
http://pastebin.com/XyzVDigT


#2

Oh that sounds frustrating! Can you pastebin what’s in your Procfile?


#3

I can! http://pastebin.com/Jxt6Tv8H


#4

Huh. The reason why I asked is because of the error line, “Push failed: cannot parse Procfile.”

Is it in the right location and has that upper-case “P”?


#5

Yup. I also did some digging around on forums, which led me to try this:

(not letting me post the pastebin link for some reason but)

(venv) PS C:\Users\briana\projects\myhellowebapp> git pull heroku master
fatal: Couldn’t find remote ref master


#6

Can you open up your Git Config file? Either open up the file (the config file in a hidden folder called .git in your main project folder), and the contents should look something like this:

[core]
	repositoryformatversion = 0
	filemode = true
	bare = false
	logallrefupdates = true
	ignorecase = true
	precomposeunicode = true
[remote "heroku"]
	url = https://git.heroku.com/hwatest.git
	fetch = +refs/heads/*:refs/remotes/heroku/*

…or you can paste in git config --list in your project and let me know if you see something like this:

...
remote.heroku.url=https://git.heroku.com/hwatest.git
remote.heroku.fetch=+refs/heads/*:refs/remotes/heroku/*
...

(and show me what it says if it has something related to heroku?)

Basically it sounds like Heroku’s git integration was configured wrong, and I’d like to see how it was actually set up. :)


#7

Thanks for your help! How’s this look to you?

[core]
    repositoryformatversion = 0
    filemode = false
    bare = false
    logallrefupdates = true
    symlinks = false
    ignorecase = true
    hideDotFiles = dotGitOnly
[remote "heroku"]
    url = https://git.heroku.com/myhellowebapp-ohp.git
    fetch = +refs/heads/*:refs/remotes/heroku/*
[remote "origin"]
    url = https://git.heroku.com/myhellowebapp-ohp.git
    fetch = +refs/heads/*:refs/remotes/origin/*

#8

Huh, I wonder if the remote “origin” is messing it up since it’s pointing to Heroku. Try removing that section (everything under remote "origin" and try pushing again?

Buuut I suspect that won’t work since it really doesn’t seem to like your Procfile. Hmmm. Is the folder your settings.py file in named “hellowebapp”?


#9

Ok I think I restored the thread, can you see my response now?


#10

Yup. I got it now! I removed the remote “origin” section. Also tried making a new Procfile (with the same info in it) and overwriting the last one, just in case. Still throwing the same error message.


#11

Soooo I’m going to suggest the nuclear option. I would make a new Heroku account (or I think you can do two projects from the same account…) and start the chapter over and see if doing everything from scratch will make it work. :)

Alternatively… you could put the code on a public Github and I can try on my end.

I’m baffled but I am sure it’s something small that we’re missing. :)


#12

Hello everyone !
Apparently I am late, very late.
But the problem still persists, I just spent 10+ hours stuck on this kind of problems (not yet with Hello Web App, though I want to read it in a short while), I mean to make Heroku work… It is clearly not made for Windows users like me (ie who are rather beginners in IT).
For your particular problem, here is the solution I found :

  1. Create a Procfile (without any extension) : to do this create it from Windows Powershell ; write
    New-Item C:\the path to the root of your project\Procfile
  2. Download Notepad++. Notepad would not be enough.
  3. Open your new Procfile file with Notepad++ and write whatever you need to write inside. For me it was simply :
    web: gunicorn learning_log.wsgi --log-file -
    (I am following "Python Crash Course, which was excellent up to now to learn Python, but in chapters 18-20 Eric Matthes develops a simple website, only for Mac and Linux users ; he did not say that so I believed I could succeed ; I am losing a lot of time but I am stubborn)
  4. click Encoding/Encode in ANSI (the reason for Notepad++)
  5. save (do not choose “save as” since you do not want an extension for this file)
    Not too long once you know how to do it :-)
    Have fun with your app !

#13

I had this problem , I fixed it by using this Pipfile config:

[[source]]
url = "https://pypi.python.org/simple"
verify_ssl = true

[packages]
dj-database-url = "*"
django = "*"
gunicorn = "*"
psycopg2 = "*"
whitenoise = "*"
requests = "*"

[requires]
python_version = "3.6"

I also changed my git config by removing the GitHub master completely


#15

Thank you so much
This solved my problem