web123456

git push error failed to push some refs to workaround

1: Reason

When we found a problem in the git version library, if you modified it online on git, but did not synchronize the local library (to do itBefore pushing, pull firstBy following the code, you can ensure that the code of the local library and the remote library is consistent). At this time, if you commit again and want to submit the local library to the remote git library, there will be a push failure problem.

failed to push some refs to

Two: Solve

Method: 2.1

This is caused by inconsistent with the code of the remote library and the local library. We just need to synchronize the remote library to the local library, and use the following command:

git pull --rebase origin master

The command means merging the new ones in the remote library into the local library (there may be conflicts that need to be resolved). The function of --rebase is to cancel the commits just submitted in the local library and connect them to the updated version library.
 

Method: 2.2

Or use the following command to withdraw the commit code, and then git pull it.

git reset --soft HEAD^