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

Git推送报错:fatal: bad boolean config value 'origin' for 'push.autosetupremote'

解决办法

这个错误是因为你把布尔类型的配置项push.autosetupremote错误设置成了字符串值origin,Git无法解析非布尔值导致的。按以下步骤修复:

  • 先确认当前错误配置:
    git config --get push.autosetupremote
    执行后会返回origin,验证问题所在。

  • 修正配置:
    如果你需要Git自动为新分支设置推送关联(也就是实现直接git push推送其他分支的需求),执行全局配置命令:
    git config --global push.autosetupremote true
    要是只想针对当前仓库生效,去掉--global参数即可:
    git config push.autosetupremote true

    如果你不需要这个自动关联功能,也可以设为false:
    git config --global push.autosetupremote false

  • 验证修复:
    再次执行git config --get push.autosetupremote,返回true或false就说明配置正确了,此时再尝试git push就能正常推送代码。

补充:push.autosetupremote的作用是,当你推送本地新创建的分支时,Git会自动建立本地分支与远程分支的追踪关系,后续无需指定远程仓库和分支名,直接用git push就能推送。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.04 20:32:32