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 http://mystash.com/A/1.git
git clone http://mystash.com/A/2.git
git clone http://mystash.com/A/3.git
git clone http://mystash.com/A/4.git
git clone http://mystash.com/A/4.git
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?
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: https://github.com/RisingOak/stashy
# stashget PROJECT_KEY
#!/usr/bin/python import sys import os import stashy stash = stashy.connect("http://localhost/stash", "USERNAME", "PASSWORD") for repo in stash.projects[sys.argv].repos.list(): for url in repo["links"]["clone"]: if (url["name"] == "ssh"): os.system("git clone %s" % url["href"]) break
You need create ssh key!
Steps: Open Terminal
pbcopy < ~/.ssh/id_rsa.pub (This command copied clipboard your ssh key)
1)Go to your stash site. Click Manage Account Tab2) Click Add key Button3)Paste (ctrl + v) Key Area -> Click Add key button
4-> Run your python script
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 http://email@example.com/scm/"projectcode"/$i.git
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 (https://bitbucket.org/atlassianlabs/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
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:
Hey Community! I work on the Bitbucket product marketing team. With Halloween approaching, we wanted to discuss a topic tailor-made for October: development horror stories. Whether it was a lurk...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events