batch remove of many repositories/projects in Stash/Bitbucket Server

Hello,

 

for testing new Bitbucket version I've cloned our production server and renamed it to "test". The problem is, I don't want to have production repos on this "test" instance because of security reasons, but as far  I understood in order to remove all projects I need to remove associated repos first, every one by opening it and click "delete" button. I have around 100 repos, is  there another way to automate/speed up it?

 

Thanks,

Stan

2 answers

1 accepted

2 votes
Mikael Sandberg Community Champion Aug 03, 2016

Your could use the REST API and create a script to remove the repositories. /rest/api/1.0/projects/{projectKey}/repos/{repositorySlug} has an option for delete.

1 vote

Forgive the advertising but you can do this with ScriptRunner for Bitbucket Server

Please see this example which can be run in Admin -> ScriptRunner -> Script Console and will remove all repositories for a particular project and could easily be adapted to your needs.

Its worth checking out if you want to automate particular tasks in Bitbucket Server or customise your instance.

You can find out more from the documentation about how ScriptRunner for Bitbucket Server can help you.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jun 12, 2018 in Bitbucket

Do you use any Atlassian products for your personal projects?

After spinning my wheels trying to get organized enough to write a book for National Novel Writing Month (NaNoWriMo) I took my affinity for Atlassian products from my work life and decided to tr...

174 views 20 8
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you