Skip to main content
This lesson demonstrates how to use GitHub Enterprise repository policies to govern repository creation and other lifecycle operations across organizations in your enterprise. Repository policies let you centralize control for sensitive actions—like creating, deleting, transferring, or changing visibility—by targeting specific organizations and applying allow lists (bypass lists) of identities or roles.

Where to start

  1. In your enterprise account, open the Policies tab.
    Enterprise policies can govern many areas (Actions, Codespaces, Advanced Security, member privileges). This guide focuses on repository policies and how to restrict repository creation to approved identities.
  2. At the enterprise level, create a ruleset and:
    • Define the ruleset name and activate it.
    • Configure an allow list of users or roles (for example, organization owners or admins).
    • Target the organization(s) and repositories to which the ruleset should apply.
    • Choose enforcement options (restrict creations, deletions, transfers, name or visibility changes).
Below is an example policy configuration that restricts repository creation to only identities on the allow list.
  • Name the policy (for example: repo-policy-1).
  • Activate the policy.
  • Add the desired identities to the allow list — in this demo we add the organization owners/admins.
  • Target one or more organizations — here we target the Game Dev Studio organization.
A dark-themed screenshot of a GitHub Enterprise settings page for creating a repository policy named "repo-policy-1," showing enforcement status, an allow list with "Organization admin," and targeting criteria (name: game-devstudio). The left sidebar shows navigation items like Actions, Codespaces, Advanced Security, and Personal access tokens.

Selecting repositories and enforcement options

After targeting organizations, select whether the policy should apply to:
  • All repositories in the targeted organization(s), or
  • A subset of repositories (scoped by name patterns or selection).
For this demo we target all repositories and enable Restrict creations, so only identities on the allow list can create repositories in the targeted organization(s).
A dark-mode screenshot of a GitHub Enterprise settings page for targeting repositories and configuring repository policies. It shows policy options like "Restrict visibility," "Restrict creations" (checked), "Restrict deletions," and a green "Create" button at the bottom.

How enforcement behaves in practice

  • Owners/admins on the policy allow list: can create repositories in the targeted organization(s) as usual.
  • Regular members not on the allow list: will be unable to create repositories; the targeted organization will be disabled or blocked when attempting to create a new repository.
The screenshot below shows creating a new repository while signed in as an owner/admin. Because this user is included on the allow list, they can select the Game Dev Studio organization and proceed with repository creation.
A screenshot of GitHub's "Create a new repository" page in dark mode. The repository name field is filled with "new-repo" and configuration options like visibility, README, .gitignore, and license are visible.

Quick reference: enforcement options

Best practices and checklist

  • Test policies in a non-production organization before broad rollout.
  • Use allow lists conservatively—prefer role-based entries (organization owners, admins) rather than large user lists.
  • Combine policy targeting with repository naming patterns or tags to scope enforcement precisely.
  • Monitor policy effects and audit logs after activation to ensure expected behavior and to catch any unintended restrictions.
Enterprise repository policies are enforced at the enterprise level and apply only to the organizations and repositories you explicitly target. Make sure to test policy behavior in a non-production org before rolling out broadly.

Watch Video