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

之后再正常拉取即可

相关推荐
TDengine (老段)19 分钟前
TDengine vs InfluxDB — 全方位对比
大数据·数据库·物联网·时序数据库·tdengine·涛思数据·iotdb
DevOpenClub35 分钟前
全球区域与 IP 定位工作台案例方案
大数据·网络·网络协议·tcp/ip
2601_9620739740 分钟前
大数据-258 离线数仓 - Griffin架构 配置安装 Livy 架构设计 解压配置 Hadoop Hive
大数据·hadoop·架构
2601_9620746844 分钟前
大数据-263 实时数仓 - Canal 工作原理 工作流程 MySQL Binglog基本介绍
大数据·数据库·mysql
胖大和尚1 小时前
当前仓库推送到同一台机器上的另一个文件夹
git
用户3610588626122 小时前
SparkStreaming 之 transform 算子详解及代码实现
大数据·spark
AI备案指南-满满2 小时前
数字虚拟人也开始备案了:AI虚拟人“生成式AI备案 + 算法备案“双重合规全解析
大数据·人工智能·机器人·生成式人工智能·算法备案
Sky1987star2 小时前
Sales Agent OS 为什么必须保留人工接管与结果回写?
大数据·人工智能
Microsoft Word2 小时前
AI Agent入门:从LLM、上下文和工具到Harness工程
大数据·人工智能·机器学习
2601_962076252 小时前
大数据-267 实时数仓 - ODS Lambda架构 Kappa架构 核心思想
大数据·架构