git拉取时报错

报错如下

git -c diff.mnemonicprefix=false -c core.quotepath=false --no-optional-locks fetch --no-tags origin

From https://gitee.com/erzhan/qgisdemo

d7c043e...c9e341f master -> origin/master

git -c diff.mnemonicprefix=false -c core.quotepath=false --no-optional-locks pull origin master

From https://gitee.com/erzhan/qgisdemo

  • branch master -> FETCH_HEAD

hint: You have divergent branches and need to specify how to reconcile them.

hint: You can do so by running one of the following commands sometime before

hint: your next pull:

hint:

hint: git config pull.rebase false # merge

hint: git config pull.rebase true # rebase

hint: git config pull.ff only # fast-forward only

hint:

hint: You can replace "git config" with "git config --global" to set a default

hint: preference for all repositories. You can also pass --rebase, --no-rebase,

hint: or --ff-only on the command line to override the configured default per

hint: invocation.

fatal: Need to specify how to reconcile divergent branches.

原因:

这个错误是 Git 2.27+ 版本的新特性,它不再默认选择合并策略,而是要求你明确指定如何处理分歧的分支。下面提供两种最常用的解决方案:

解决:

在命令终端执行

git config --global pull.rebase false,意思是设置全局默认使用 merge 方式(最常用、最安全)

之后再正常拉取即可

相关推荐
瑞熙贝通实验室综合管理平台6 分钟前
实验动物中心|LAMS实验动物智慧管理系统标准解决方案|新一代合规化、智能化、全闭环实验动物中心数字化管控方案
大数据
Gu_WenYun8 分钟前
1+N 管家模式重塑家庭财富管理:本元家办的全周期实践路径
大数据·金融
2601_9603563821 分钟前
2027校招:数据科学与大数据技术专业应聘数字化解决方案顾问的能力准备清单
大数据
Aloudata24 分钟前
Metric Layer 建设指南:如何先从核心指标层启动企业语义工程
大数据·人工智能·数据分析·data agent·语义层
jerryinwuhan26 分钟前
HV-DGTF数据治理框架
大数据·人工智能
零域码客1 小时前
RAG 和微调解决的是同一类问题吗?从大模型底层全链路拆解两者的本质与选择逻辑
大数据·人工智能·机器学习·模型微调·fine-tuning·检索增强生成·llm 架构
一招合理1 小时前
互联网金融洗牌加剧,大数据风控成平台突围关键
大数据
财迅通Ai1 小时前
开拓全球合作新机遇 科兴制药亮相CPHI Milan 2026
大数据·人工智能·科兴制药
Elasticsearch1 小时前
使用 Elastic Stack 丰富邮政地址信息 —— 第一部分
elasticsearch
yichengerp2 小时前
国内中小电子工厂用哪个erp系统好?
大数据·运维·人工智能·云计算·制造