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 方式(最常用、最安全)

之后再正常拉取即可

相关推荐
thubier(段新建)15 小时前
owtb 3pl 面向城市配送物流企业需求V0.2
大数据·人工智能
jinggongszh17 小时前
智能硬件对接与系统落地:开发岗在制造现场的经验沉淀
大数据·人工智能
ZeekerLin17 小时前
AI 原生团队协作机制:角色、分工与工程文化变化
大数据·人工智能
ACP广源盛1392462567319 小时前
IX8024 PCIe4.0 交换芯片@ACP# RK3588:嵌入式 AI PC 标准化扩展方案
大数据·人工智能·分布式·单片机·嵌入式硬件
梦想三三19 小时前
Git与GitHub基础入门:从零开始掌握版本控制与代码托管(完整图文教程)
人工智能·git·elasticsearch·github
2601_9557596220 小时前
code0 gemini-2.5-pro 企业实战:数据分析团队怎样更快产出报告
大数据·人工智能·数据分析
2601_9557594121 小时前
code0 gpt-5.5 场景相关:教育平台智能批改与答疑实操
大数据·人工智能·gpt
蜡笔削薪21 小时前
财联支付异地拓展商户的区域限制是否符合监管规定?
大数据·python
2601_957190901 天前
飞行影院安装施工指南:场地、动感系统与影片内容配套
大数据·前端·人工智能