Missed Team ’24? Catch up on announcements here.

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

Bitbucker prehook configurations

shahebaaz shaikh September 18, 2019

I am using Windows system.

I am configuring Bit-bucket precommit hooks, Use case is "I want to reject all the commits that doesn't have a valid JIRA key"

I have tried different plugins like "Yet another commit checker" "Control Freak" and some other free plugins from market place.

I have also tried to do it via script present in .git folder through gitbash, However, I want to do it on server level.

Could you please help me with how to add this restriction via any free plugins or script?

1 answer

1 accepted

0 votes
Answer accepted
Julius Davies _bit-booster_com_
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.
September 18, 2019

 

I'm one of the Control Freak maintainers.  I recommend setting it up like this (click on "Administration" --> "Control Freak"):

jira-policy.png

That setup will force all commits on the protected branches (master, production, release/*) to have Jira tickets in their commit messages.

shahebaaz shaikh September 18, 2019

Thanks for your response @Julius Davies _bit-booster_com_ 

I took reference of your another answer present at https://community.atlassian.com/t5/Bitbucket-questions/Require-issue-keys-in-commit-messages/qaq-p/1171253 and tried configuring with Control freak.

However, the problem that i am facing with control freak is that i can pass jira issue key in square bracket only and it is not accepting any other commit message other than [Jira_issue_key]

Let's take an example, If my JIRA issue key is AP-242, please find following actions

Accepted commit: commit -m [AP-242]

All other commits are getting rejected other than above, like I am not  able to provide any commit message. Could you please provide me how exactly you are committing to bitbucket repository with commit message.

Actuallly i am not getting any error at commit, but i am facing error while pushing code "Control freak rejected your push"

I have tried following, However, Control freak is rejecting

commit -m "AP-242 Change in add button"

commit AP-242 "Change in add button"

I have tried almost all possible ways to give commit message, However Control freak is rejecting everything, If you could let me me know how you are adding message to your commit  that will be really helpful.

I am using Git-bash to commit code.

Appreciate your help!

BAZ

shahebaaz shaikh September 19, 2019

Thanks for your response @Julius Davies _bit-booster_com_ 

I took reference to your other answer present at https://community.atlassian.com/t5/Bitbucket-questions/Require-issue-keys-in-commit-messages/qaq-p/1171253 and tried configuring with Control freak.

However, the problem that I am facing with control freak is that I can pass Jira issue key in square bracket only and it is not accepting any other commit message other than [Jira_issue_key]

Let's take an example, If my JIRA issue key is AP-242, please find following actions

Accepted commit: commit -m [AP-242]

All other commits are getting rejected other than above, like I am not  able to provide any commit message. Could you please provide me how exactly you are committing to bitbucket repository with commit message.

Actuallly i am not getting any error at commit, but I am facing error while pushing code "Control freak rejected your push"

I have tried following, However, Control freak is rejecting

commit -m "AP-242 Change in add button"

commit AP-242 "Change in add button"

I have tried almost all possible ways to give commit message, However Control freak is rejecting everything, If you could let me me know how you are adding message to your commit  that will be really helpful.

I am using Git-bash to commit code.

Thanks in Advance!

BAZ

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events