Vince Vince - 1 year ago 123
Git Question

Delete multiple repositories at once in Atlassian Stash

I have a project with roughly 30 repositories inside my stash. I fiddled around with them a bit and now I want to reset everything and re-import them. As far as I could see, there is no way to "clean" a repository in Stash, so I decided to just delete them and create them again. Since there are a bunch of repositories, and this is probably not the last time I'm going to do this, I would be really thankful for a way to delete/create multiple repositories at once, since I would need a considerable amount of time to do this manually via the frontend. Does anyone know, if that is possible?

Answer Source

Stash developer here. I haven't seen a plugin on Marketplace that would do that. Would a simple bash script that uses our REST api work for you?

for path in 'projectA/repos/repoA' 'myprojectB/repos/myrepoB' 'somethingC/repos/somethingC'; do curl -X DELETE --user username:password http://host:port/rest/api/1.0/projects/$path; done

Or something like that

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download