How to prevent push -f at git repository on bitbucket?
There are some people working on repository and it will be bad if someone make
push -f with only first commit.
How to prevent this action at Bitbucket?
2 Solutions collect form web for “How to prevent push -f at git repository on bitbucket?”
The solution is to give write access to only the developers that you trust. Normally you have the team lead managing the main repository, and everyone else has forked a copy of this repository.
Using this method, everyone has their own copy that they can destroy if they wish and it won’t affect your main repository. Once the contributors are ready to merge their code, they need to create a pull request. It is at this point the team lead is able to review the changes and accept/reject.
Not only does this method protect against
push -f commits, it prevents many other unwanted changes as well.
The git option you are looking for is
receive.denyNonFastForwards. Bitbucket should let you configure that: https://bitbucket.org/site/master/issues/4002/allow-users-to-set-the-flag