Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Curiosity about depth when cloned in pipeline

Ray December 5, 2022

When I ran the pipeline, I didn't set the depth separately,

but I could see that it was running as `git clone -n --branch {MY_BRANCH} source` or running as `git clone --brach {MY_BRANCH} --depth 50 source` depending on the case.

I would like to know about the conditions for being cloned.

1 answer

0 votes
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 6, 2022

Hello @Ray ,

Thank you for reaching out to Atlassian Community!

Bitbucket pipelines indeed use a shallow clone by default to clone your repository into the build container. This is implemented to reduce the time spent in cloning the repository to the build environment, especially for large repositories. Usually, your build will just need the most recent commits, so there would be no need to clone the older ones. By default, we clone only the last 50 commits.

However, it's possible to configure the depth of the clone in your pipeline in case you need to access older commits or have a full clone of the repository. This is sometimes necessary when working with other tools that do not support shallow clones.

To change the clone depth you can use the clone:depth attribute as in the below example: 

clone:
depth: full # include the full history

pipelines:
default:
- step:
name: Cloning
script:
- echo "Clone all the things!"

The depth value can be a whole number greater than zero. Use full for a full clone.

More details in Configure bitbucket-pipelinesyml : Clone

Hope that helps! If you have any questions, feel free to ask.

Than you, @Ray .

Patrik S

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events