Tag Archives: error: failed to push some refsLinuxGit

Git error: failed to push some refs [How to Solve]

To https://[email protected]/name/mywork.git
! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to ‘https://[email protected]/name/mywork.git’
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes before pushing again.  See the ‘Note about
fast-forwards’ section of ‘git push –help’ for details.

 

When using git push, I was prompted with the following error message, and after checking a lot of information about it via git push –help and then /fast-forwards, I was unable to find a solution.
After googling, I found that it was caused by a conflict between the version of the code in the remote repository and the local inconsistency.

Solution:
git pull
Automatically merge again or manually merge conflicts
git push again

successfully solved the problem.