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

之后再正常拉取即可

相关推荐
上海蓝色星球1 天前
造价机器人CER V2.0正式上线!
大数据·人工智能·智慧城市·运维开发
八角Z1 天前
AI价值跃迁的核心:输出责任转移与新兴工种的精准重塑
大数据·人工智能·科技·机器学习·计算机视觉·服务发现
无忧智库1 天前
某流域“十五五”国家水网骨干工程智慧水利调度系统项目深度解析:构建数字孪生流域的顶层设计与实施路径(WORD)
大数据
ZKNOW甄知科技1 天前
深度对标ServiceNow:燕千云如何破解企业全球化运维难题?
大数据·运维·人工智能·科技·ai·自动化·运维开发
YDS8291 天前
SpringCloud —— Elasticsearch的DSL查询
java·elasticsearch·搜索引擎·spring cloud
月光下的麦克1 天前
Git 打 Tag 的作用
git
DJ斯特拉1 天前
git基本使用
git
瑞华丽PLM1 天前
通用与专业PLM选型对比 (1)
大数据·人工智能·plm·瑞华丽plm·瑞华丽
我命由我123451 天前
Git 问题:Author identity unknown*** Please tell me who you are.
java·服务器·git·后端·学习·java-ee·学习方法
低调小一1 天前
OpenClaw 从安装到可用:把 Tools/Skills 变成“可控操控面板”,并用飞书做远程入口
java·大数据·人工智能·飞书·openclaw·clawbot·skil