Jenkins can't talk to Git after upgrade

We have a Jenkins instance running on a Windows PC (Windows 11). It was neglected for years but has been upgraded from 2.236 (JDK 8) to 2.415 (JDK 11). All plugins were out-of-date but are now updated. Some versions: Git plugin: 5.2.0; Git client plugin: 4.4.0; Git Parameter plugin: 0.9.19

Our 2.236 version had many jobs that ran fine and all connected to our company’s internal Bitbucket repository and internal Nexus (we use https not ssh). However, now that we’ve upgraded, none of those jobs can connect. On the surface, it looks like the upgrade went OK (i.e. it looks like all the config.xml files came across OK) but I know the problem likely lies in some change between all those versions we had to jump.

When we configure the SCM portion of the job, we enter the Git connection info and save it just fine but when we go back in to the configure page, we see the Oops Jenkins message on the repo. In the log, we see NullPointer by UserRemoteConfig/checkUrl caused by java.base/java.util.TreeMap.putAll(

The SCM polling triggered job git polling log says “Failed to record SCM polling for hudson.model.FreeStyleProject” caused by: java.lang.NullPointerException: Cannot invoke “java.util.Map.size()” because “map” is null

I have searched the Internet for help but maybe I’m not searching for the right thing and have come up empty. Thanks for reading this far…

This problem has been resolved. I’m going to reply to my own question in case it helps others.

The key was seeing a fatal message in the job’s console output that the Environment Injector Plugin was harvesting environment variables to pass on to our job. This was all well and good but it turns out we had no environment variables to inject. Our Jenkins global properties (Manage Jenkins → System → Global Properties → Environment Variables) was checked but we never added any. Evidently, this was OK in previous versions but not in the current version (2.901.v0038b_6471582). Once we unchecked that box (or left it checked but added a key/value pair), our Git problems went away and our builds started functioning.

Obviously I’m very happy we ran across this. However, it was just chance that we did. It would be great if something were changed to detect that or to provide a better error message in the log. In hindsight, looking at the plugin is obvious but that’s only because of hindsight.