Background
Jenkins is being used to build an artifact from a Git repo that has a Git submodule. The submodule(s) are not in the same repo or even at the same endpoint as the parent project. The problem is that parent repo checks out fine because the credential, ssh key A, is associated with the main/parent repo but, not surprisingly, fails on the submodule because the credential, ssh key B, is not associated with the repo from Jenkins' point of view.
It's surprising that Jenkins does not have better out-of-the-box support for Git submodules; time to contribute.
Questions
- Is there a way to store multiple credentials for a single Git repo?
- If the answer is no, why does Jenkins, under Advanced sub-modules behaviours provide the option to Use credentials from default remote of parent repository as shown below?
- What other approach is there for dealing with Jenkins and Git submodules with different credentials?
System Info
Running Jenkins on Docker Machine (Locally)
Running Jenkins on CentOS (Production)
Jenkins Version: 2.60.2 (both)
Git Plugin Version: 3.6.4 (both)