Is there a way to control user commits on Bit Bucket - Online File Editing?

We have a requirement to restrict users to do the Code Check-Ins, if it is not associated with a Jira Ticket number. We have achieved this functionality already (using YACC pre-receive hook ) when users are trying to check-in from any tool outside the bit bucket (like Git Bash, Git Gui, Git extension, any IDE etc..). However the online edit from bit bucket is uncontrolled. Any one with write permission can do direct edit the file with out giving reference to any Jira ticket number on their commits. 

Could any one please let us know if there is a way, we can put restrictions for this online edit option in bit bucket, to follow some rules before pushing their commits.

Thanks in advance!

1 answer

0 vote

Is this Bitbucket Cloud or Bitbucket Server?

Either way, you should be able to use branch permissions to restrict use of the online edit tool on a given branch.

Must be Server since YACC (Yet-Another-Commit-Checker) is a Bitbucket Server app.

I also maintain a competing (but paid) app that does similar things: Control Freak for Bitbucket Server.  Like YACC, it also doesn't yet enforce on direct file edits in the UI, but I think I could have that implemented within 1-2 weeks.  I'll update my response here when I have that in place.

@James Redmond,  (we are using Bitbucket Server). Thanks for the reply, but the branch restriction is giving only 4 ways to prevent check-in which does not help much to my scenario. 

1. Prevent all changes

2. Prevent deletion

3. Prevent rewriting history

4. Prevent changes without a pull request

I want to allow users to check-in only when they use the Jira ticket number as part of their commits. The online edit does not allow any rules in settings. 

@G. Sylvie Davies [bit-booster.com]

Writing a repository hook that enforces the same logic for pushes, online edits and pull request merges should be trivial for 5.x. 

Just write a hook that implements PreRepositoryHook<RepositoryHookRequest> and check the RepositoryHookRequest.getTrigger() to only opt-in for pushes, online-edits and pull request merges.

If you already have a hook, it might be a couple of lines of code to change.

See the hooks and merge check guide for more details.

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...

22,775 views 26 12
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