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

之后再正常拉取即可

相关推荐
sun0077001 天前
执行repo sync -c -d -j4以后,提交未git push的代码看不到了。要怎么恢复?
git
财经三剑客1 天前
AI元年,春节出行安全有了更好的答案
大数据·人工智能·安全
岁岁种桃花儿1 天前
Flink CDC从入门到上天系列第一篇:Flink CDC简易应用
大数据·架构·flink
TOPGUS1 天前
谷歌SEO第三季度点击率趋势:榜首统治力的衰退与流量的去中心化趋势
大数据·人工智能·搜索引擎·去中心化·区块链·seo·数字营销
胖虎11 天前
Git 一个本地仓库同时推送到两个远程仓库(详细教程)
git·多远程仓库·双远程仓库·git双远程·git备份
2501_933670791 天前
2026 高职大数据与会计专业零基础能考的证书有哪些?
大数据
ClouderaHadoop1 天前
CDH集群机房搬迁方案
大数据·hadoop·cloudera·cdh
TTBIGDATA1 天前
【Atlas】Ambari 中 开启 Kerberos + Ranger 后 Atlas Hook 无权限访问 Kafka Topic:ATLAS_HOOK
大数据·kafka·ambari·linq·ranger·knox·bigtop
程序员清洒1 天前
CANN模型部署:从云端到端侧的全场景推理优化实战
大数据·人工智能
lili-felicity1 天前
CANN多设备协同推理:从单机到集群的扩展之道
大数据·人工智能