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

之后再正常拉取即可

相关推荐
Ajie'Blog27 分钟前
Claude 大模型深度评测:从参数架构到实战边界
大数据·人工智能·架构
暴躁小师兄数据学院1 小时前
【AI大数据工程师特训笔记】第13讲:数据库性能手术刀
大数据·数据库·数据仓库·sql·postgresql
wh_xia_jun1 小时前
Git 分支合并操作备忘录
git
无忧智库1 小时前
车路云一体化复杂交通博弈多智能体系统可行性研究报告(WORD)
大数据·人工智能·自动化
愤怒的苹果ext1 小时前
Flink同步到ES时间遇到的问题
elasticsearch·flink·时间
数据皮皮侠AI1 小时前
上市公司耐心资本数据(2010-2025)
大数据·人工智能·笔记·能源·1024程序员节
陕西企来客1 小时前
陕西 KNIT 可信知识网络构建模块对于 GEO 优化行业的影响深度调查:企来客科技技术落地真相揭示
大数据·人工智能
共享家95272 小时前
OpenClaw核心功能
大数据·elasticsearch·搜索引擎
Quincy_Freak2 小时前
银河麒麟aarch64如何高效做数据分析?分享一款内网离线数据分析利器
大数据·数据库·数据挖掘·数据分析·aarch64
满天星83035773 小时前
【Git】原理及使用(三)(分支管理)
linux·git