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

之后再正常拉取即可

相关推荐
ha_lydms2 小时前
3、Spark 函数_d/e/f/j/h/i/j/k/l
大数据·分布式·spark·函数·数据处理·dataworks·maxcompute
ha_lydms4 小时前
AnalyticDB导入MaxCompute数据的几种方式
大数据·数据仓库·阿里云·dataworks·maxcompute·odps·analyticdb
拓端研究室4 小时前
专题:2025电商行业洞察报告:数字化、订阅电商、内容营销、B2B|附200+份报告PDF、数据、可视化模板汇总下载
大数据·人工智能
毕设源码-钟学长4 小时前
【开题答辩全过程】以 基于大数据的化妆品推荐系统为例,包含答辩的问题和答案
大数据
sheji34164 小时前
【开题答辩全过程】以 基于大数据的健康评估管理系统的设计与实现为例,包含答辩的问题和答案
大数据
无限进步_4 小时前
C++ Vector 全解析:从使用到深入理解
开发语言·c++·ide·windows·git·github·visual studio
charlee444 小时前
Git使用经验总结9-Git提交关联到Issue
git·issue
豌豆学姐4 小时前
123 口播数字人 API 接入实战:附完整前后端开源项目
大数据·php·uniapp·开源软件
不爱吃糖的程序媛4 小时前
cJSON 适配 OpenHarmony PC 完整指南
大数据·elasticsearch·搜索引擎