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

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

stankopp-ni August 3, 2016

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
Answer accepted
Mikael Sandberg
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 3, 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
adammarkham
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.
August 30, 2016

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.

Eugen Mayer
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.
December 22, 2018

I forgave you very quickly - since this solved my issue the most elegant way. Thank you for sharing the knowledge and the product :)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events