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 all repositories from a project in stash

Is there a way i can clone all the existing repositories from a project in stash in a simple way?

Lets say I have project called "A" and there are 5 reporitories say 1,2,3,4,5. I would like to clone all the repositories in project A in a simple way rather than doing

git clone

git clone

git clone

git clone

git clone


7 answers

1 accepted

4 votes
Answer accepted
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Sep 05, 2013

Hi Vishal,

I'm afraid Git doesn't allow that, they have to be cloned separately.

Hypothetically you could have another repository that uses Submodules to link to the others, and then use git submodule to clone them down. You would have to keep that other repository up-to-date, which would be a pain. Submodules link by using commits. I personally wouldn't recommend that - it's not really buying you much.

You could also write a script that uses Stash's REST resources to list the repositories in a project and then clone them all in succession.

I'm curious - how often are people clone the repositories? Once you have them locally you dont' really need to clone them again. Is this for a build perhaps?



Hey charles - Thanks for the prompt response. Yes it is for the build purpose. I will be working all the repositories of all the projects from various teams. I want a simply way to clone all repositories.

Like Gabriel_Degret likes this
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Sep 05, 2013

Hi Vishal,

I thought so. :)

So it's gets interesting at this point. What kind of dependencies do you have between each of your repositories then? If you clone them all down, how do you know what version/branch of each repository to build? Is it always master? If that's the case how do you handle old release versions?

Generally I would recommend that you would except one build per repository. So what we do here is use maven as our dependency management, and we use maven versions to tie two separate repositories together. It means we can make changes to one repository without affecting another.

You might find that submodules are an easy(ish) way to get started with this kind of versioning. As mentioned previously, you can have another repository would would then 'link' all of your child repositories together at specific versions. You would then need to modify this parent repository before changes in a child repo was built. This may or may not be what you are looking for. Depending on your language/environment you might be able to use something like Ruby Gems, Python Eggs, etc. I would recommend these over using submodules, but would require a more substantial change to your build process.

The quick answer to your actual question would proably be to just configure your build (Bamboo? Jenkins?) to clone each repository manually. I know in Bamboo you can have multiple repositories per plan. It's not really an automated solution - but it's probably the easiest (assuming you don't have like 100 repositories).

Sorry for the long rant.


Hey Charles -

There is no dependency between the repositories. I want latest version of code of all the repositories to be available. We will build anything which is latest and yes it is always master. I am handling old releases with TAG's.

I have around 20 repositories. And My build system(Jenkins) is configured to build individual repositories. Its just my individual request that I want to clone each and every repository in stash.

I will try submodules and thanks again!!!


Here is quick script using stashy - a python rest api client for stash:

# stashget PROJECT_KEY


import sys
import os
import stashy

stash = stashy.connect("http://localhost/stash", "USERNAME", "PASSWORD")
for repo in stash.projects[sys.argv[1]].repos.list():
    for url in repo["links"]["clone"]:
        if (url["name"] == "ssh"):
            os.system("git clone %s" % url["href"])

Thanks Faik, works awesome!

hi, as of 'm running the above script m getting error. so can you please tell me which all places i have to edit and place my data.

You need create ssh key! 
Steps: Open Terminal

pbcopy < ~/.ssh/ (This command copied clipboard your ssh key)

 1)Go to your stash site. Click Manage Account TabScreen Shot 2019-07-14 at 02.13.36.png2) Click Add key ButtonScreen Shot 2019-07-14 at 02.14.11.png3)Paste (ctrl + v) Key Area -> Click Add key buttonScreen Shot 2019-07-14 at 02.14.18.png

4-> Run your python script

Thanks Faik this worked great!

If you're using git bash or cmd in your local (which I think most of us use)
you can just type the following 

for i in reponame1 reponame2 reponame3 ...
git clone"projectcode"/$i.git

@Divin Honnappa thanks that was simple and effective

$ curl -s  -k --user YourUserName | python -c 'import sys, json; r = json.loads(; [sys.stdout.write(d["name"]+"\n") for d in r]'


Using @archenroot answer ,I have created a repo with springBoot Rest api to clone all repos from url.

Thanks to archenroot


Hi guys, I found this discussion while looking for similar solution. The python stashy didn't work for me, so I wrote simple Java app which do the same:

It actually access all projects where user has permission to read, iterate trough all repositories of all projects and clone them to directory structure:


|---- repo1

|---- repo2


|---- repo1

|---- repo2



We are facing the same problems with > 50 projects and > 100 repositories. Most of them are built with Jenkins . 

There is one project to configure the build jobs of Jenkins and I am working on the small management component (internally called "Metagit"). This is based on the stash-java-client ( and uses Ant as a frontend.


We automate the following workflows:

1. Pull / Clone a set of repos

2. Create a feature branch

2a. Search and modify (if needed) e.g. Maven versions ...

2b. Commit and Push

3. Create a Pull Request for the new branch



Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events