Q:

Empty Git Repo Stuck in Endless Push/Pull ErrorLoop

I recently created a github repo that was empty, and I got stuck in a loop of repeating error messages that don't seem to have a resolution with the suggested messages offered by git. 
I add a file:
git add filename
git commit -m "commit message"
git push origin master

Which gives me the following message:
Updates were rejected because the tip of your current branch is behind. 
its remote counterpart.  Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again. 

So I try:
fatal: refusing to merge unrelated histories

Then I try:
git push -f

Which gives me: 
fatal: The current branch master has no upstream branch. 
To push the current branch and set the remote as upstream, use

git push --set-upstream origin master

But if I try that I get:
error: failed to push some refs to 'https://github.com/JonathanBechtel/cdc-  
dashboard.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart.  Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again. 
hint: See the 'Note about fast-forwards' in 'git push --help' for details. 

If I try git stash -u I'm told that I have no files to stash. 
Does anyone have an explanation for this repeating loop of error messages? 

A:

Use this:
git pull origin master --allow-unrelated-histories

Then your git push should succeed:
git push origin master

As this SO article discusses, you may be getting the unrelated histories error during the first pull because your local branch appears as new and having nothing in common with the history of the remote branch.