If you are working on a branch and it gives you this error message when you do a git push, you need to run:
git pull origin master
and now the git push will work. This happens when the master changes and you have not updated the local copy with the changes in the remote master branch.