Enforcing repository management policies in your enterprise

Enterprise owners can enforce certain repository management policies for all organizations owned by an enterprise account, or allow policies to be set in each organization.

In this article

Configuring the default visibility of new repositories in your enterprise

Each time someone creates a new repository on your enterprise, that person must choose a visibility for the repository. When you configure a default visibility setting for the enterprise, you choose which visibility is selected by default. For more information on repository visibility, see "About repository visibility."

If an enterprise owner disallows members from creating certain types of repositories, members will not be able to create that type of repository even if the visibility setting defaults to that type. For more information, see "Setting a policy for repository creation."

  1. In the top-right corner of GitHub AE, click your profile photo, then click Enterprise settings. "Enterprise settings" in drop-down menu for profile photo on GitHub AE
  1. In the enterprise sidebar, click Policies. Policies tab in the enterprise account sidebar

  2. Under Policies, click Options. Options tab in the enterprise account settings sidebar

  3. Under "Default repository visibility", use the drop-down menu and select a default visibility. Drop-down menu to choose the default repository visibility for your enterprise

Warning: If you add an image attachment to a pull request or issue comment, anyone can view the anonymized image URL without authentication. To prevent unauthorized access to image URLs on GitHub AE, consider restricting network traffic to your enterprise. For more information, see "Restricting network traffic to your enterprise."

Setting a policy for changing a repository's visibility

When you prevent members from changing repository visibility, only enterprise owners can change the visibility of a repository.

If an enterprise owner has restricted repository creation to organization owners only, then members will not be able to change repository visibility. If an enterprise owner has restricted member repository creation to private repositories only, then members will only be able to change the visibility of a repository to private. For more information, see "Setting a policy for repository creation."

  1. In the top-right corner of GitHub AE, click your profile photo, then click Enterprise settings. "Enterprise settings" in drop-down menu for profile photo on GitHub AE

  2. In the enterprise sidebar, click Policies. Policies tab in the enterprise account sidebar

  3. Under " Policies", click Repositories. Repositories tab in the enterprise account settings sidebar

  4. Under "Repository visibility change", review the information about changing the setting. Optionally, to view the current configuration for all organizations in the enterprise account before you change the setting, click View your organizations' current configurations. Link to view the current policy configuration for organizations in the business

  5. Under "Repository visibility change", use the drop-down menu and choose a policy. Drop-down menu with repository visibility policy options

Setting a policy for repository creation

Organization owners can always create any type of repository, and outside collaborators can never create any type of repository. For more information, see "About repository visibility."

  1. In the top-right corner of GitHub AE, click your profile photo, then click Enterprise settings. "Enterprise settings" in drop-down menu for profile photo on GitHub AE

  2. In the enterprise sidebar, click Policies. Policies tab in the enterprise account sidebar

  3. Under " Policies", click Repositories. Repositories tab in the enterprise account settings sidebar

  4. Under "Repository creation", review the information about changing the setting. Optionally, to view the current configuration for all organizations in the enterprise account before you change the setting, click View your organizations' current configurations. Link to view the current policy configuration for organizations in the business

  5. Under "Repository creation", select a policy. Drop-down menu with repository creation policy options

  6. If you selected Members can create repositories, select one or more repository types. Checkboxes for repository types

Enforcing a policy on forking private or internal repositories

Across all organizations owned by your enterprise, you can allow people with access to a private or internal repository to fork the repository, never allow forking of private or internal repositories, or allow owners to administer the setting on the organization level.

  1. In the top-right corner of GitHub AE, click your profile photo, then click Enterprise settings. "Enterprise settings" in drop-down menu for profile photo on GitHub AE

  2. In the enterprise sidebar, click Policies. Policies tab in the enterprise account sidebar

  3. On the Repository policies tab, under "Repository forking", review the information about changing the setting. Optionally, to view the current configuration for all organizations in the enterprise account before you change the setting, click View your organizations' current configurations. Link to view the current policy configuration for organizations in the business

  4. Under "Repository forking", use the drop-down menu and choose a policy. Drop-down menu with repository forking policy options

Setting a policy for repository deletion and transfer

  1. In the top-right corner of GitHub AE, click your profile photo, then click Enterprise settings. "Enterprise settings" in drop-down menu for profile photo on GitHub AE

  2. In the enterprise sidebar, click Policies. Policies tab in the enterprise account sidebar

  3. Under " Policies", click Repositories. Repositories tab in the enterprise account settings sidebar

  4. Under "Repository deletion and transfer", review the information about changing the setting. Optionally, to view the current configuration for all organizations in the enterprise account before you change the setting, click View your organizations' current configurations. Link to view the current policy configuration for organizations in the business

  5. Under "Repository deletion and transfer", use the drop-down menu and choose a policy. Drop-down menu with repository deletion policy options

Setting a policy for Git push limits

To keep your repository size manageable and prevent performance issues, you can configure a file size limit for repositories in your enterprise.

By default, when you enforce repository upload limits, people cannot add or update files larger than 100 MB.

  1. In the top-right corner of GitHub AE, click your profile photo, then click Enterprise settings. "Enterprise settings" in drop-down menu for profile photo on GitHub AE
  1. In the enterprise sidebar, click Policies. Policies tab in the enterprise account sidebar

  2. Under Policies, click Options. Options tab in the enterprise account settings sidebar

  3. Under "Repository upload limit", use the drop-down menu and click a maximum object size. Drop-down menu with maximum object size options

  4. Optionally, to enforce a maximum upload limit for all repositories in your enterprise, select Enforce on all repositories Enforce maximum object size on all repositories option

Configuring the merge conflict editor for pull requests between repositories

Requiring users to resolve merge conflicts locally on their computer can prevent people from inadvertently writing to an upstream repository from a fork.

  1. In the top-right corner of GitHub AE, click your profile photo, then click Enterprise settings. "Enterprise settings" in drop-down menu for profile photo on GitHub AE
  1. In the enterprise sidebar, click Policies. Policies tab in the enterprise account sidebar

  2. Under Policies, click Options. Options tab in the enterprise account settings sidebar

  3. Under "Conflict editor for pull requests between repositories", use the drop-down menu, and click Disabled. Drop-down menu with option to disable the merge conflict editor

Configuring force pushes

Each repository inherits a default force push setting from the settings of the user account or organization to which it belongs. Likewise, each organization and user account inherits a default force push setting from the force push setting for the enterprise. If you change the force push setting for the enterprise, it will change for all repositories owned by any user or organization.

Blocking all force pushes on your appliance

  1. In the top-right corner of GitHub AE, click your profile photo, then click Enterprise settings. "Enterprise settings" in drop-down menu for profile photo on GitHub AE
  1. In the enterprise sidebar, click Policies. Policies tab in the enterprise account sidebar

  2. Under Policies, click Options. Options tab in the enterprise account settings sidebar

  3. Under "Force pushes", use the drop-down menu, and click Allow, Block or Block to the default branch. Force pushes dropdown

  4. Optionally, select Enforce on all repositories, which will override organization and repository level settings for force pushes.

Blocking force pushes to a specific repository

Note: Each repository automatically inherits default settings from the organization or user that owns it. You cannot override the default setting if the repository's owner has enforced the setting on all of their repositories.

  1. Sign in to your enterprise at http(s)://HOSTNAME/login.
  2. From an administrative account on GitHub AE, click in the upper-right corner of any page. Rocketship icon for accessing site admin settings
  3. In the search field, type the name of the repository and click Search. Site admin settings search field
  4. In the search results, click the name of the repository. 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. Select Block or Block to the default branch under Push and Pull. Block force pushes

Blocking force pushes to 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 enterprise.

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

  1. Sign in to your enterprise at http(s)://HOSTNAME/login.
  2. From an administrative account on GitHub AE, click in the upper-right corner of any page. 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 enterprise-wide policy. Block force pushes

Enforcing a policy on the default branch name

  1. In the top-right corner of GitHub AE, click your profile photo, then click Enterprise settings. "Enterprise settings" in drop-down menu for profile photo on GitHub AE

  2. In the enterprise sidebar, click Policies. Policies tab in the enterprise account sidebar

  3. On the Repository policies tab, under "Default branch name", enter the default branch name that new repositories should use. Text box for entering default branch name

  4. Optionally, to enforce the default branch name for all organizations in the enterprise, select Enforce across this enterprise. Enforcement checkbox

  5. Click Update. Update button

Did this doc help you?Privacy policy

Help us make these docs great!

All GitHub docs are open source. See something that's wrong or unclear? Submit a pull request.

Make a contribution

Or, learn how to contribute.