Reject Force Push Prehook

Kabir Kochhar March 5, 2014

I have installed the "Reject Force Push" prehook under a stash git repository and its enabled. But I am still able to execute git push --force command to delete the branches from git bash. What am I doing wrong? I am looking for a certain role to push / merge changes but not rewrite history / delete a particular branch. Stash "WRITE" access seems to provide git push with force push rights. I am trying to setup similar security in Stash and there seems to be out of box pre-hook available that might do the trick but probably I am missing some configuration.

3 answers

2 votes
DevOps-Tally_ May 28, 2018

We are also facing the same issue. Even though Reject force push hooks are enabled, users are still able to force push changes using -f option. Is there any additional configuration which needs to be done apart from enabling the hook?

1 vote
Sujatha M May 28, 2018

We are also facing the same issue. Even though Reject force push hooks are enabled, users are still able to force push changes using -f option. Is there any additional configuration which needs to be done apart from enabling the hook?

DJM October 29, 2018

Hi

 

Did you got any response for this

we too are seeing this issuse

Thanks

DJM

0 votes
cofarrell
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.
March 5, 2014

Hi Kabir,

That doesn't sound right. Just to confirm you're talking about the default Reject Force Push hook that's shipped with Stash (that has the Darth Vadar icon)?

When you say "deleted" do you mean force pushed, or actaully removed? The force push hook will only stop the former, branches can still be deleted.

There's no extra configuration required, and it may mean something is wrong on the server:

https://confluence.atlassian.com/display/STASHKB/Pull+Requests+Not+Reflecting+Changes+Pushed+to+Remote+Branch+After+an+Upgrade

Ignore the title, it may be same underlying problem. You may want to raise a support ticket and attach the support zip so we can take a closer look.

Charles

Kabir Kochhar March 6, 2014

Charles, we are conducting Stash POC using trial version now. One of our requirements is to push changes but to restrict history rewrites and branch deletions for certain roles. So considering GITFlow traditional model, as an example: developer could have access to push changes to remote "develop" integration branch but not delete it. Gerrit provides advanced branch security to handle it.

Kabir Kochhar March 7, 2014

I am successfully able to test pre-receive hook "Protect unmerged branch hook" as a use case but still not able to test "Reject Force Push hook". I dont know what I am doing wrong...... When I execute the command "git push --force" for any branch, I am still able to force push successfully. Any help is appreciated !!!

cofarrell
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.
March 7, 2014

Hi Kabir,

That's very strange. I would probably expect all of the hooks to work or not. I've not seen the reject force push hook fail like that.

You're not pushing to your fork or something downstream are you? Hook settings are per repository and aren't inherited.

Would you be able to attach the output of the force push and a screenshot of the enabled hook? Feel free to do that here or on a support ticket (or both).

Charles

Kabir Kochhar March 10, 2014

I am able to run the plugin successfully and go through the use case.

Charles, Is there a plugin available in marketplace to restrict branch deletion but allow users to create branches or push changes to it.

Vijay kumar August 28, 2015

Hi Kabir... Even i am facing the same issue where the "Reject Force Push" plugin does not seem to be working. What changes did you do for it work for you. Thanks Vijay

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events