Git 异常-fatal: refusing to merge unrelated histories

 Administrator@Ken-PC MINGW64 /c/MyCode/LanChuan/game-data (master)
$ git branch --set-upstream-to=origin/master master
Branch 'master' set up to track remote branch 'master' from 'origin'.
Administrator@Ken-PC MINGW64 /c/MyCode/LanChuan/game-data (master)
$ git pull
fatal: refusing to merge unrelated histories

使用如下命令,更换仓库的地址:

  1. git remote remove origin
  2. git remote add origin git@123.0.0.1/xxx.git
  3. git pull

导致如上异常,解决方法如下:

直接强制合并日志信息

git pull --allow-unrelated-histories