Error prompt:
Cheetah@xxxx MINGW64 /e/Projs/enft/data/cv_key_frame (master)
$ git push
To github.com:AnthonyGIS/video_frame.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to '[email protected]:AnthonyGIS/video_frame.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
Cheetah@xxxx MINGW64 /e/Projs/enft/data/cv_key_frame (master)
The reason for the non fast forward problem is that there is already some code in Git repository, so it does not allow you to directly cover your code
method 1
Push, that is, use strong coverage to replace the content in Git warehouse with your local code
If the remote warehouse is just built and there is no code, or you are sure that the code in the remote warehouse is useless, you can operate in this way and try to avoid this operation method
git push -f
Method 2
First fetch git to your local area, then merge and then push
$ git fetch
$ git merge
If, when git merge occurs
fatal: refusing to merge unrelated histories
You can use, git pull origin master –allow-unrelated-histories, to take care of that.
Continue with git merge
If, in case of.
fatal: You have not concluded your merge (MERGE_HEAD exists).
Please, commit your changes before you merge.
is that we haven’t committed the current changes, git add . , git commit -am “commit message”, then git merge again, and ok.
Finally, git push.(git push origin master).
It prompts Already up-to-date, and the upload is done.