git仓库报错【 ! [rejected] master -> master (non-fast-forward)error: failed to push some refs to】

This problem occurred in the first submission. The reason for the error is that some files in the remote warehouse are not in the local warehouse, as shown below:
insert image description here
Solution 1: (recommended)
git pull --rebase origin master <locally generated ReadMe file>
git add .
git commit -m "second commit" <second commit>
git rebase --continue <resolve conflicts>
git push origin master <push to remote>
Solution 2: (not recommended)
git push -f origin master <mandatory overwrite remote file>

Method 2 is not recommended, it is best not to use it during team development!

Original link: https://blog.csdn.net/forever__fish/article/details/126498311

Guess you like

Origin blog.csdn.net/zch981964/article/details/132213571