Jenkins: Retrieving submodules with Git Jenkins: Retrieving submodules with Git jenkins jenkins

Jenkins: Retrieving submodules with Git


Here is a workaround using SSH agent forwarding. It worked fine for me.

  1. First, edit <jenkins_home>/.ssh/config and set ForwardAgent yes
  2. Then, install SSH Agent plugin for Jenkins.
  3. Then, in project configuration, reset the Git credentials.
  4. Finally, in project configuration, set the SSH Agent credential.

enter image description hereSSH Agent settings in Jenkins project configuration


Beta versions of the git-client and git-plug-in modules have been released now to solve this issue. To quote the JIRA issue.

The git client plugin 2.0.0-beta1 has been released to the experimental update center. It includes git submodule authentication, JGit 4.3, and requires JDK 7. It requires at least Jenkins 1.625 (the first version to mandate JDK 7)

Using the above there is an option under the Additional Behaviours section called:

Use credentials from default remote of parent repository

This solved my issue when using Jenkins 2.11 and the beta versions of the plug-in running a Windows server and slave. I have not checked other build machines.Also you must use the same authentication method, if using http you must use that for submodules as well, if use SSH you must use this for the submodules, trying to mix methods will not work correctly.

-- UPDATE --
Beta versions are not required anymore, please see the following pages:
Git Client Plugin
Git Plugin


I just hit this issue. For anyone coming at this with a recent version of Jenkins (post December 2016) try enabling this option in the Advanced sub-modules behaviours section of your git repo config.Use credentials from default remote of parent repository