remove "create repository" link from project page in Stash UI

We have implemented a Jenkins job that uses Stash REST API to create a repository, populate with a standard .gitignore file, and a default README.md file.  The job then creates a standardized set of branch permissions.

We want to enforce that all repositories are created using this Jenkins job.  Unfortunately, some project admins continue to use the "Create Repository" link on their project page and end up creating repositories that do not conform to our standards.

I would like to remove the "Create Repository" link from the UI so that users MUST use our Jenkins job to create the repository according to our standards.

Is there a template file somewhere that I can update to get rid of the "Create Repository" link and possibly add a link to our Jenkins job?

1 answer

Hi,

You can only disable the creation of personal repositories by configuration (feature.personal.repos=false in Stash's/Bitbucket Servers properties file). To not allow the creation of new repositories in the UI, you would have to write a plug-in. I would suggest to use a servlet filter for "projects/*/repos?create" and then show a page with a warning that repositories should be created through your Jenkins job:

httpResponse.sendRedirect("/your-page");

Of course, there are also commercial plug-ins available that can help you here (e.g., Repository Templates and ScriptRunner for Bitbucket).

Hope that helps.

Best regards,

Michael

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Piotr Plewa
Published Dec 27, 2017 in Bitbucket

Recipe: Deploying AWS Lambda functions with Bitbucket Pipelines

Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda&nbsp...

2,007 views 1 5
Read article

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