Github and Heroku: A Beginner’s Guide

Disclaimer — I’m by no means an expert on Github nor Heroku. Just a beginner trying to help others who might be having the same problem. So if I mess anything up here, please tell me! Thank you.
I don’t recommend the following advice for teams, only for individuals trying to keep their public repo updated.
The objective was to display my code on Github, as a portfolio. Sounds simple, right? After all, Heroku allows you to connect to a remote repo. See their Github Integration documentation.
They claim that:
When GitHub integration is configured for a Heroku app, Heroku can automatically build and release (if the build is successful) pushes to the specified GitHub repo.
This simply did not prove to be true, however, when deploying to the heroku remote. git push heroku master wasn’t doing anything to the repo on my Github page, even though the web app was updating correctly.
I don’t know if that’s a common error, but here’s how I fixed (*cough* forced) it.
> git remote add github https://github.com/username/repo.gitThis adds your personal repo to the current directory. If you type git remote -v you should see two lines which begin with github, and two lines that begin with heroku.
> git push github Should update your public github repo, which is separate from the private repo that heroku utilizes. But personally, I just kept getting this error:
Pushing to git@github.com:519ebayproject/519ebayproject.git
To git@github.com:519ebayproject/519ebayproject.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:519ebayproject/519ebayproject.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.This example error taken from this StackOverflow post.
I tried git pull heroku, git add . , git commit -m “please work” , which is the safe! way—to no avail..
So I resorted to this command which can erase previous commits so please be careful!!
git push -f github masterThis basically forces github to ignore all the warnings and just commit to your repo.
