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

之后再正常拉取即可

相关推荐
七夜zippoe12 小时前
Elasticsearch核心概念与Java客户端实战 构建高性能搜索服务
java·大数据·elasticsearch·集群·索引·分片
vx_bisheyuange12 小时前
基于SpringBoot的知识竞赛系统
大数据·前端·人工智能·spring boot·毕业设计
TDengine (老段)12 小时前
TDengine C# 语言连接器入门指南
大数据·数据库·c#·时序数据库·tdengine·涛思数据
瑞华丽PLM12 小时前
AI+数字孪生赋能制造业数字化转型
大数据·人工智能·plm·国产plm·瑞华丽plm·瑞华丽
钟佩颖12 小时前
Git .
git
王九思13 小时前
大数据查询工具Hive介绍
大数据·hive·hadoop
檐下翻书17313 小时前
HR人力资源管理流程图在线绘制方法
大数据·人工智能·架构·流程图·论文笔记
无忧智库14 小时前
一网统飞:城市级低空空域精细化管理与服务平台建设方案深度解析(WORD)
大数据·网络·人工智能
木头程序员14 小时前
持续学习(Continual/Lifelong Learning)综述
大数据·人工智能·深度学习·机器学习
Hello.Reader14 小时前
Apache Cassandra Connector:Flink 与宽列存储的高吞吐协作
大数据·flink·apache