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

升级至Eclipse 2023-03后Git拉取/推送时出现NullPointerException

Eclipse 2023-03 Git拉取/推送触发NullPointerException(无法打开分支配置)

升级至Eclipse 2023-03版本后,执行Git拉取(Pull)或推送(Push)操作时,每次都会触发NullPointerException,错误日志如下:

java.lang.NullPointerException: Cannot invoke "java.lang.Enum.toString()" because "defaultValue" is null
    at org.eclipse.egit.core.internal.ReportingTypedConfigGetter.getEnum(ReportingTypedConfigGetter.java:59)
    at org.eclipse.jgit.lib.Config.getEnum(Config.java:449)
    at org.eclipse.jgit.api.PullCommand.getRebaseMode(PullCommand.java:534)

有时仅在错误日志中显示异常,拉取/推送操作无响应。经排查该异常与分支配置中的rebase mode(变基模式)相关,但因相同异常无法通过分支上下文菜单打开「Branch configuration...」。

解决方法

  • 手动修改本地Git配置文件
    无法通过Eclipse界面修改时,直接编辑仓库根目录下的.git/config文件:

    1. 找到对应分支的配置段(格式为[branch "你的分支名"])
    2. 添加或修改rebase配置项为有效值,例如:
      [branch "main"]
        rebase = false
      
      有效值包括true、false、preserve、interactive,按需选择。
  • 更新EGit插件
    Eclipse 2023-03默认的EGit版本可能存在该BUG,可通过Eclipse市场更新插件:

    1. 打开Help > Eclipse Marketplace
    2. 搜索「EGit」,点击「Update」完成更新
    3. 重启Eclipse后重试操作
  • 重置Git全局配置(针对全局配置异常场景)
    若全局Git配置存在异常的rebase相关设置,通过命令行重置:

    git config --global --unset branch.autosetuprebase
    git config --global --unset pull.rebase
    

    重置后重新打开Eclipse验证操作是否恢复正常。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.24 19:43:08