I started to get \'failed to push some refs\' error when I changed some files and tried to do push. Most instructions tell to do git pull first. I have done it and git says ever
Be sure to verify that the pull actually worked. It is possible the merge (which is part of a pull) failed.
When I had this error message I failed to notice the pull failed. The pull failed due to some uncommitted file changes (unrelated to the files I was trying to push) which caused the merge to fail. I reverted those file changes (because they were not important) and then did a pull again. After the successful pull, the push worked.