failed to push some ref to code example
Example 1: failed to push some refs to repository
git pull --rebase
git push
Example 2: git push error
Just pull repository first and then try to push again
git pull --rebase remote_repo
git push origin remote_repo