Git push fatal: refusing to merge unrelated histories

Today

appeared when I used git to submit code.

fatal: refusing to merge unrelated histories

this error prevents the code from being submitted.

Git
May.14,2022

this problem is due to an unmerging error caused by the push of two unrelated libraries (local and remote libraries).

there are two solutions to this problem:

now clone the remote library code and copy the local library code into it and resubmit it
merge two code bases using forced merge

git pull origin master-allow-unrelated-histories

after the code is merged, git push can be executed

Menu