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

之后再正常拉取即可

相关推荐
程序员IT行业1 小时前
化工原料进销存安全管控数字化方案|解决危化品台账混乱、效期严控、分次发货溯源难题
大数据
CNSSIRD数据库5 小时前
中国企业环境信用数据库2003-2026
大数据·数据库·数据分析·论文笔记
玄芯散人5 小时前
【筑基·058】Git协作工作流:冲突解决和PR流程
git·版本控制·团队协作
大大大大晴天5 小时前
每天认识一个组件:数据集成Apache SeaTunnel
大数据
广州宏帝箱包5 小时前
出口箱包的包装标准:防潮、防摔、运输安全的设计要点
大数据·网络
Geeys6 小时前
拼多多新店起流玩法:免费流量打底+付费流量爆发
大数据
日常筹谋记6 小时前
自动化仓储安全防护工况评估:明治传感器AS-33C技术适配性分析
大数据·运维·创业创新·业界资讯
updayday8546 小时前
离职域账号状态变更与Ping64操作记录核对
大数据·网络·数据库·安全·智能路由器
baopixiaoz6 小时前
BeeQuant × BeeAgent:用AI加速策略验证
大数据·人工智能·python·区块链
智商网输送线配件7 小时前
2026 自动化流水线配件采购难题破解:小批量混批与非标定制的供应链实测
大数据·人工智能·自动化·智商网·流水线设备配件