Get started with Bitbucket Cloud
New to Bitbucket Cloud? Check out our get started guides for new users.
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.
1
2
3
4
5
6
7
8
9
10
11
12
13
clone:
enabled: false
pipelines:
default:
- step:
script:
- echo "No code cloned!"
- step:
clone:
enabled: true
script:
- echo "Repo cloned in this step!"
1
2
3
4
5
6
7
8
9
clone:
lfs: true # See the lfs property documentation prior to enabling
depth: 2
pipelines:
default:
- step:
script:
- ls -R $BITBUCKET_CLONE_DIR
1
2
3
4
5
6
7
8
9
10
11
12
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
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
1
2
3
4
5
6
7
8
clone:
depth: 2
pipelines:
default:
- step:
script:
- ls $BITBUCKET_CLONE_DIR
1
2
3
4
5
6
7
pipelines:
default:
- step:
clone:
depth: 2
script:
- ls $BITBUCKET_CLONE_DIR
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
1
2
3
4
5
6
7
8
clone:
enabled: false
pipelines:
default:
- step:
script:
- echo "No code cloned!"
1
2
3
4
5
6
7
8
9
10
pipelines:
default:
- step:
clone:
enabled: false
script:
- ls -R $BITBUCKET_CLONE_DIR
- step:
script:
- ls -R $BITBUCKET_CLONE_DIR
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
1
2
3
4
5
6
7
8
9
clone:
lfs: true
pipelines:
default:
- step:
name: Clone and download
script:
- echo "Clone and download my LFS files!"
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
pipelines:
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
Only available for self-hosted pipeline runners.
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)
1
2
3
4
5
6
7
8
9
pipelines:
default:
- step:
runs-on:
- 'self.hosted'
clone:
skip-ssl-verify: true
script:
- echo "Use git with a self-signed certificate"
Was this helpful?