You can block force pushes (git push --force
) on all branches—or just the default branch—of an organization's repositories.
Each repository inherits a default setting from its owner (an organization or user account). You can override this default setting unless the repository's owner has chosen to enforce the setting on all of its repositories.
Search for an organization from the Command Bar (or go directly to its URL).
-
Click the "Admin tools" button at the top of the page.
-
Select Admin from the menu on the left side of the page.
-
Select Block or Block to the default branch under Force pushes.
-
Optionally select Enforce on all repositories to block force pushes on all repositories owned by the organization.
The change takes effect immediately. If you change your mind later, you can easily re-allow force pushes at the same location in the admin tools.