Jenkins git submodule update fails Jenkins git submodule update fails jenkins jenkins

Jenkins git submodule update fails


Based on the earlier answers here, I re-prioritized upgrading my client's Jenkins. Now they are on Jenkins 2.41 with Git plugin 3.0.1 and before additional configuration this did not fix the issue. I found the configuration to be a little tricky:

  1. Add top-level repository to Source Code Management -> Git
  2. Select the "Additional Behaviours" Add button
    • Select "Advanced sub-modules behaviours"
  3. I tested with only "Recursively update submodules" and got the "Permission denied" error (see bottom*)
  4. However, I now select both "Recursively update submodules" and "Use credentials from default remote of parent repository" in Jenkins 2.41

Once I select both options, it uses the credentials I had configured for the top-level repository and everything works for me. Here is what the dialog looks like in 2.41 with Git plugin 3.0.1:git submodule authentication configuration under Jenkins 2.41

* Here is the essence of my "Permission denied" error:

Cloning into 'thirdparty'...

stderr: Permission denied (publickey). fatal: The remote end hung up unexpectedly Clone of 'ssh://hg@bitbucket.org//thirdparty' into submodule path 'thirdparty' failed

PS Just before posting, I did my usual double check to make sure I'm not duplicating an answer. In this case, I see that @danielfn's comment points to something that is nearly identical to my answer, but 1. this didn't help me and I ended up figuring it out by trial and error and 2. it is StackOverflow policy to post answers here rather than referencing external links.


As an alternative, you may use 'Source Code Management' - 'Multiple SCMs' to manually configure all the sub-modules and add 'Additional Behaviours' - 'Check out to a sub-directory' for each one.


It seems that they have fixed it with the versions git client plugin 1.20.0-beta1 and git plugin 2.5.0-beta1. However, they can only be added to Jenkins by specifying to pull updates from the experimental update center.