You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Flutter升级失败求助:从3.16.5升级至3.19版本报错

解决Flutter升级时Git对象错误的方案
  • 清理本地Git缓存并重新拉取
    进入Flutter安装目录,依次执行命令:

    git gc --prune=now
    git fetch --prune
    git reset --hard origin/stable
    

    完成后再运行flutter upgrade试试。

  • 重置Flutter远程仓库地址
    先检查当前远程仓库地址是否正常:

    git remote -v
    

    如果地址不对,重置为官方仓库地址:

    git remote set-url origin https://github.com/flutter/flutter.git
    

    接着执行git fetch --tags,之后再尝试flutter upgrade。

  • 手动重新克隆Flutter仓库(终极方案)
    要是前面的方法都不管用,先备份好本地pub缓存和相关配置,然后删掉原来的Flutter目录,重新克隆稳定版仓库:

    git clone https://github.com/flutter/flutter.git -b stable
    

    克隆完成后配置好环境变量,最后用flutter --version验证版本是否正确。

内容的提问来源于stack exchange,提问作者ESY CRM

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.28 07:49:50