The Git clone
options section of the bitbucket-pipelines.yml
allows you to change the Git clone behavior in Bitbucket Pipelines, including disabling or selectively enabling Git clone operations (performed at the start of every step). Most of these settings can be applied globally or to individual steps.
The following options can be configured using the clone
option:
The clone
property provides options for controlling how your repository is cloned by Bitbucket Pipelines during a build.
The following options are available for controlling the git clone behavior for the whole pipeline:
lfs
— support for Git LFS.
depth
— the depth of the Git clone.
enabled
— allows the Git clone to be disabled.
Additionally, the skip-ssl-verify
option is available when the clone
property is applied to an individual step
when the step is run on a self-hosted pipeline runner.
Property — clone
Required — No
Data type — Block of new-line separated key-value pairs (YAML spec - Block Mapping)
Allowed parent properties — step or the YAML root (clone
can be a top-level property)
Allowed child properties — Requires one or more of the lfs, depth, and enabled properties. skip-ssl-verify is allowed when the clone
element is in a step.
clone: enabled: false pipelines: default: - step: script: - echo "No code cloned!" - step: clone: enabled: true script: - echo "Repo cloned in this step!"
Example — using clone to configure global git clone behavior for a pipeline clone: lfs: true # See the lfs property documentation prior to enabling depth: 2 pipelines: default: - step: script: - ls -R $BITBUCKET_CLONE_DIR
Example — using clone to customize git clone behavior on a single step pipelines: default: - step: runs-on: - self.hosted - linux clone: lfs: true # See the lfs property documentation prior to enabling depth: 2 skip-ssl-verify: true script: - ls -R $BITBUCKET_CLONE_DIR
Depth
Defines the depth of Git clones for all pipelines or a pipeline step. Use full
for a full clone. If not specified, the default is the last 50 commits. For information on the Git clone depth option, visit Git Documentation — git clone.
Property — depth
Required — No
Data type — Integer or String
Allowed values — full
(for full depth) or any positive integer
Default value — 50
Allowed parent properties — clone
Example — using the depth option to only clone the last two commits for every step in the pipelineclone: depth: 2 pipelines: default: - step: script: - ls $BITBUCKET_CLONE_DIR
Example — using the depth option to only clone the last two commits for a single step pipelines: default: - step: clone: depth: 2 script: - ls $BITBUCKET_CLONE_DIR
Enabled
The clone
enabled
option is used to disable the git clone operation which is run at the start of every step. The enabled
option can be used to disable Git clone operations for a single step
, or for all steps.
Property — enabled
Required — No
Data type — Boolean
Allowed values — true
or false
Default value — true
Allowed parent properties — clone
Example — using the clone enabled option to disable git clone for all stepsclone: enabled: false pipelines: default: - step: script: - echo "No code cloned!"
Example — using the clone enabled option to disable git clone on a pipeline step pipelines: default: - step: clone: enabled: false script: - ls -R $BITBUCKET_CLONE_DIR - step: script: - ls -R $BITBUCKET_CLONE_DIR
LFS
The lfs
options instructs git to download all LFS files for the repository during git clone operations. When lfs
is set to true
as a global option, all LFS files will be downloaded at the start of every step. When lfs
is set to true
on an individual step, then all the LFS files will be downloaded for that step. We recommend using LFS on individual steps or to download only the required files for each step to reduce build times and resource usage.
Property — lfs
Required — No
Data type — Boolean
Allowed values — true
or false
Default value — false
Allowed parent properties — clone
Example — using LFS to download all LFS files in every stepclone: lfs: true pipelines: default: - step: name: Clone and download script: - echo "Clone and download my LFS files!"
LFS (GIT only) - Enables the download of LFS files in your clone. If defaults to false if not specified. Note that the keyword is supported only for Git repositories.
Example — using lfs to selectively download LFS filespipelines: default: - step: name: Clone with lfs on clone: lfs: true script: - ls -lh large-file.zip # 26M large-file.zip - step: name: Clone with lfs off clone: lfs: false script: - apt-get update && apt-get install -y git-lfs # Download only desired files - git lfs pull --include=large-file.zip - ls -lh large-file.zip # 26M large-file.zip
Skip SSL verification
The skip-ssl-verify
option disables SSL verification during git clone, allowing the use of self-signed certificates.
Property — skip-ssl-verify
Required — No
Data type — Boolean
Allowed values — true
or false
Default value — false
Allowed parent properties — clone (when clone is set in a step)
Example — using skip-ssl-verify to disable SSL verification on git clone operationspipelines: default: - step: runs-on: - 'self.hosted' clone: skip-ssl-verify: true script: - echo "Use git with a self-signed certificate"
Was this helpful?
It wasn't accurateIt wasn't clearIt wasn't relevant
Still need help?The Atlassian Community is here for you.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4