Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to clone all the repos of a specific project to the local system

sreekanth M
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 10, 2019

I know how to clone the single repo to the local system.

let's assume i have the project of X and having 10 reops. i wanted to clone all the repos related to the project X all at once, instead  of cloning every repo one of after the other.

 

 

1 answer

0 votes
Daniil Penkin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 10, 2019

Hello @sreekanth M,

Unfortunately this is not possible because Git and Mercurial don't have any concept of a group of repositories, so you can only clone repositories one by one.

This process, however, can be automated with a script:

  • You can get a list of all repositories in a project using REST API call to /2.0/repositories/{username} endpoint and BBQL filter query project.key="PROJECT_KEY", for example:
    https://api.bitbucket.org/2.0/repositories/atlassian?q=project.key%3D%22BUILDENG%22

    You can additionally get only the fields you need – in your case it's probably just the clone URL. I also included fields related to the pagination – the script should walk through all the pages (although it might be enough to simply increase the page size up to 100 items).
    https://api.bitbucket.org/2.0/repositories/atlassian?q=project.key%3D%22BUILDENG%22&fields=values.links.clone.*,size,next,page
  • You can then fetch each repository using these URLs. Multiple clone operations can be run at once, so it shouldn't necessarily be serial process.

Hope this helps. Let me know if you have any questions.

Cheers,
Daniil

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events