简体   繁体   中英

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM