Article version: Enterprise Server 2.14

This version of GitHub Enterprise will be discontinued on This version of GitHub Enterprise was discontinued on 2019-07-12. No patch releases will be made, even for critical security issues. For better performance, improved security, and new features, upgrade to the latest version of GitHub Enterprise. For help with the upgrade, contact GitHub Enterprise support.

Blocking force pushes to repositories owned by a user account or organization

You can block force pushes (git push --force) on all branches or just the default branch of repositories owned by a user account or organization.

Repositories inherit force push settings from the user account or organization to which they belong. User accounts and organizations in turn inherit their force push settings from the force push settings for the entire appliance.

You can override the default inherited settings by configuring the settings for a user account or organization.

  1. Sign in to your GitHub Enterprise Server instance at http(s)://HOSTNAME/login.

  2. In the upper-right corner of any page, click .

    Rocketship icon for accessing site admin settings

  3. In the search field, type the name of the user or organization and click Search.

    Site admin settings search field

  4. In the search results, click the name of the user or organization.

    Site admin settings search options

  5. In the upper-right corner of the page, click Admin.

    Admin Tools

  6. In the left sidebar, click Admin.

    Admin Tools

  7. Under "Repository default settings" in the "Force pushes" section, select

    • Block to block force pushes to all branches.
    • Block to the default branch to only block force pushes to the default branch.
      Block force pushes
  8. Optionally, select Enforce on all repositories to override repository-specific settings. Note that this will not override an appliance-wide policy.

    Block force pushes The change takes effect immediately. If you change your mind later, you can re-allow force pushes.

Further reading

Ask a human

Can't find what you're looking for?

Contact us