<p>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:</p>

<pre><code>sh "git checkout ${custom_env_var} ${custom_parameter}
</code></pre>

<p>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. </p>

CC BY-SA 4.0
2018-12-08T10:04:36.440Z
2018-12-09T08:12:35.383Z
2018-12-09T08:12:35.383Z
simbo1905
<p>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:</p>

<p>-Use two Jenkins jobs, one triggered by another</p>

<p>-Use a script run by a Jenkins job</p>

<p>-Add a pull to your make or other build toolchain to include the outside library</p>

CC BY-SA 4.0
2018-08-10T00:12:19.057Z
2018-08-10T00:12:19.057Z
John Fisher
<p>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?</p>

<jenkins><bitbucket><github>
How to use Jenkins to manage a repository from Github with a submodule from Bitbucket?
david3de
# How to use Jenkins to manage a repository from Github with a submodule from Bitbucket?

(Asked by: username_0 on 2018-08-08)

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?

**Tags:** jenkins, bitbucket, github


---

## 2 answers

### Answer by username_1 on 2018-12-08. Score: 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.


---

### Answer by username_2 on 2018-08-10. Score: 0

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


---

