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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Clone a git repo jus once

For now the bitbucket pipeline clones the repo in every step.

But is there a way of just cloning once and sharing the repo files like a cache?

Or do we have to make the repo as an artifact after cloning?

1 answer

0 votes
Patrik S Atlassian Team Dec 09, 2021

Hello Marcus,

Welcome to Atlassian Community!

Just to give you a little background, Pipelines uses a server-less infrastructure, meaning that the build containers are only provisioned on demand. When your pipeline build starts, it starts a docker container with the image that you provide on the YML file, and run the script commands that you have configured. The build setup includes the following steps :

  • Pull the docker images used by that step
  • Execute a git clone operation to copy the content of the repository
  • Download cache and artifacts if available.

That being said, since every build step runs in a separate docker container, each time a step starts it will clone the repository by default.

At this moment, if you want to use the repo folder in next steps but don't want to clone it again, the only option is by creating an artifact of the repository directory, as you mentioned.

You can also use the following alternatives to improve your build :

  • Reduce the clone depth of your repository in case you don't need older commit:
      depth: 5       # include the last five commits, for example  
        - step:
            name: Cloning
              - echo "Clone just five commits!"
  • If there are steps on your pipeline where you are not using the repository, you can disable the repository clone by using the following YML flag :
    - step:
              enabled: false
              - echo "test"

Hope that helps to address your questions! :)

Kind regards,

Patrik S

Suggest an answer

Log in or Sign up to answer

Atlassian Community Events