After cloning from remote git repository (at bettercodes) I made some changes, commited and tried to push:
git push origin master
Errors
I fixed this by doing the following
git branch --unset-upstream
rm .git/refs/remotes/origin/{branch}
git gc --prune=now
git branch --set-upstream-to=origin/{branch} {branch}
#or git push --set-upstream origin {branch}
git pull
This assuming that your local and remote branches are aligned and you are just getting the refs error as non fatal.