背景:[接上篇git push 出错的随笔]当 pull 远端仓库到本地的时候,出现以下错误:

错误情况

Git 报错:fatal: refusing to merge unrelated histories

出错原因:主要原因还是在于本地仓库和远程仓库实际上是独立的两个仓库,假如我之前是直接以 clone 的方式在本地建立起远程 github 仓库克隆的本地仓库就不会有这个问题了。

解决方式:可以在 pull 命令后紧接着使用 --allow-unrelated-history 选项来解决问题(该选项可以合并连个独立启动仓库的历史)

$ git pull origin master --allow-unrelated-histories

 

相关文章:

  • 2022-12-23
  • 2021-10-13
  • 2021-11-29
  • 2021-08-12
  • 2021-06-24
  • 2022-12-23
猜你喜欢
  • 2021-04-16
  • 2021-10-22
  • 2021-08-29
  • 2021-08-11
  • 2021-04-19
  • 2022-12-23
相关资源
相似解决方案