I have done a few demos in the past few days to practice my hands. After finishing it, I want to upload it to github, and then build a corresponding warehouse on github. The result is "fatal: refusing to merge unrelated histories" when I execute git pull, the first demo I don't care about this problem. I solved it by creating a new branch and uploading it. I didn't care about the second one. I also solved it by creating another branch and uploading. git cannot pull the repository refusing to merge unrelated histories , which was successfully resolved by adding the parameter "--allow-unrelated-histories".
This problem occurs mainly with git 2.9.2 and later .
When using the Ubuntu system, it is version 2.6, and Ubuntu is version 2.16 when it switches back to Windows.
Solution:
Assuming the name of the local source is origin and the name of the remote branch is master, execute the following command:
git pull origin master --allow-unrelated-histories
Reference
git cannot pull repository refusing to merge unrelated histories