wo3kng
Last Updated: February 25, 2016
·
1.761K
· ihcsim
130921 tcl 103 s

Git: Disable Force Push

We have all heard of horror stories as a result of misusing git push --force.

If you have the appropriate permissions on your "central" git repository, you can disable force push by git config --system receive.denyNonFastForwards true.

For Github Enterprise, you can follow instructions on this page to disable force push.

For other Github repositories (the ones that most of us use daily), there are no ways to disable force push. Some workarounds include:

  1. Limiting the group of people will push privileges. Other contributions will have to come in as Pull Requests.
  2. Set up an intermediate repo on your side with a pre-receive hook to prevent force push.
Say Thanks
Respond
Filed Under