Git submodules not updating in Jenkins build


I have a submodule in a project in Jenkins. I've enabled the advanced setting to recursively update submodules.

When I run the build, I see that the workspace has the files from the submodule. The problem is, it seems to be the first revision of the submodule. When I push changes (repository hosted on GitHub) Jenkins doesn't seem to update the submodule to get the right changes. Has anyone ever seen this?

Best Solution

Note that the Jenkins Git plugin 2.0 will have "advance submodule behaviors", which should ensure proper updates of the submodules:

git 2.0

As commented by vikramvi:

Advanced sub-modules behavior > "Path of the reference repo to use during submodule update" against this field , add submodule git url.


Owen B mentions in the comments:

For the authentication issue, there's now a "Use credentials from default remote of parent repository" option

Seen here in JENKINS-20941: