I have a private bitbucket repo that is connected to the Azure DevOps Build Pipeline. The private repo has a submodule connected to a public Github repo.
Both repositories are accessed via SSH.
I have ticked the clone submodules box in DevOps.
How do I provide an SSH key to Azure DevOps so it will clone the submodule?
Git submodules allow you to keep a git repository as a subdirectory of another git repository. Git submodules are simply a reference to another repository at a particular snapshot in time. Git submodules enable a Git repository to incorporate and track version history of external code.
The git submodule init command creates the local configuration file for the submodules, if this configuration does not exist. # add submodule and define the master branch as the one you want to track git submodule add -b master [URL to Git repo] git submodule init.
In most cases, Git submodules are used when your project becomes more complex, and while your project depends on the main Git repository, you might want to keep their change history separate. Using the above as an example, the Room repository depends on the House repository, but they operate separately.
The solution for this was not to change to https, or setup a self hosted agent.
There is a step available called Load an SSH key.
I created a new ssh key on github, added the Load SSH Key step to the VSTS tasks.
It runs before the Checkout task (despite appearing in the queue afterwards) and loads the required ssh key on the agent
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With