git 提示 [fatal: 拒绝合并无关的历史] 错误


问题描述

本地初始化的项目 与 github 版本不一致, 导致无法提交

$ git pull origin master
来自 https://github.com/itaken/python-login-demo
 * branch            master     -> FETCH_HEAD
fatal: 拒绝合并无关的历史

解决方法

在pull 时候, 添加--allow-unrelated-histories参数 即可.

$ git pull origin master --allow-unrelated-histories                    129 ↵
来自 https://github.com/itaken/python-login-demo
 * branch            master     -> FETCH_HEAD
Merge made by the 'recursive' strategy.
 LICENSE | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100644 LICENSE

参考文档


Author: Itaken
Reprint policy: All articles in this blog are used except for special statements CC BY 4.0 reprint polocy. If reproduced, please indicate source Itaken !
  TOC目录