For my Jenkins build, I need to manage a Github repository to automate building a project. However, the issue is that this repository needs to pull a submodule from Bitbucket. This requires two difference instances of authentication, one for each service. As of now, Jenkins is only allowing the use of a single set of credentials, using a username and SSH key. Is there a way to specify a different set of credentials for each pull?

2 Answers 2


It is a convenience that Jenkins will pull from git for you. With such a complex setup as needing to pull from two repos you can simply use a pipeline job that runs "sh" to explicitly git checkout the code and pull the submodules:

sh "git checkout ${custom_env_var} ${custom_parameter}

The good news with this slightly manual approach is that you can debug the sh commands to run on a dev server and cut paste them straight into a pipeline. Just start a “sh” session (usually it runs bash) and test the commands.


Assuming you are populating a tree of files to do a build, and some files come from Git and some from BitBucket, here are a few suggestions:

-Use two Jenkins jobs, one triggered by another

-Use a script run by a Jenkins job

-Add a pull to your make or other build toolchain to include the outside library

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.