Deploying Git Submodules in Bitbucket Pipelines

DZone 's Guide to

Deploying Git Submodules in Bitbucket Pipelines

Take a look at this simple tutorial that explains a workaround for the missing capability for Bitbucket Pipelines to clone submodules automatically.

· DevOps Zone ·
Free Resource

Bitbucket Pipelines is a great deployment tool tightly integrated into Bitbucket. It allows you to trigger deployments directly from repository branches and tags, and you can customize your deployment steps as needed. 

One missing feature in Pipelines is that it is not able to automatically clone submodules that are added to your repository as this requires some additional settings. Until this feature gets added by default, there is a simple way to achieve this.

First, we need to make sure our repository has access to clone the sub-modules repository. You can configure this by reading Cloning another Bitbucket repository in Bitbucket Pipelines.

Next, the git submodule update --init --recursive command can initialize, fetch and checkout any nested submodules. Add it to the beginning of the script block.



    - step:
          - git submodule update --init --recursive


The above Pipeline checks out all nested submodules during its execution. We can then use them in subsequent build steps.


Deploying git submodules in Bitbucket Pipelines

bitbucket pipelines, bucket, ci/cd pipeline, devops, git, submodules, workaround

Published at DZone with permission of Ayush Sharma , DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}