|
| 1 | +--- |
| 2 | +title: Governing how people use repositories in your enterprise |
| 3 | +intro: "Create a repository policy to control who can do things like create and delete repositories." |
| 4 | +permissions: Enterprise owners |
| 5 | +versions: |
| 6 | + feature: repo-policy-rules |
| 7 | +type: how_to |
| 8 | +topics: |
| 9 | + - Enterprise |
| 10 | + - Repositories |
| 11 | +shortTitle: Govern repository usage |
| 12 | +--- |
| 13 | + |
| 14 | +{% data reusables.enterprise.repo-policy-rules-preview %} |
| 15 | + |
| 16 | +{% data reusables.enterprise.repo-policy-rules-intro %} |
| 17 | + |
| 18 | +>[!TIP] If you're an **organization owner**, you can create a repository policy for a specific organization. See "[AUTOTITLE](/organizations/managing-organization-settings/governing-how-people-use-repositories-in-your-organization)." |
| 19 | +
|
| 20 | +## Examples |
| 21 | + |
| 22 | +{% data reusables.enterprise.repo-policy-rules-examples %} |
| 23 | + |
| 24 | +## How will I target repositories? |
| 25 | + |
| 26 | +First, you'll target organizations in your enterprise. You can select all organizations, choose from a list, or create a dynamic rule using `fnmatch` syntax. If you use {% data variables.product.prodname_emus %}, you can also choose to target all repositories owned by users in your enterprise. |
| 27 | + |
| 28 | +Then, you'll target repositories in the selected organizations. {% data reusables.enterprise.repo-policy-rules-with-custom-properties %} |
| 29 | + |
| 30 | +## Interaction with other policies |
| 31 | + |
| 32 | +{% data reusables.enterprise.repo-policy-rules-with-existing-policies %} |
| 33 | +* They're visible to organization owners, so there is more transparency around what is permitted. |
| 34 | +* They allow you to target repositories owned by {% data variables.product.prodname_emus %}. |
| 35 | + |
| 36 | +## Creating a repository policy |
| 37 | + |
| 38 | +{% data reusables.enterprise-accounts.access-enterprise %} |
| 39 | +{% data reusables.enterprise-accounts.policies-tab %} |
| 40 | +1. Under "Policies", click **Repository**. |
| 41 | +1. Click **New policy**. |
| 42 | +1. Configure your new policy, then click **Create**. For help, consult the following subsections. |
| 43 | + |
| 44 | +### Policy name |
| 45 | + |
| 46 | +Use something descriptive to communicate the purpose of the policy. Organization owners can view the policy, so good names help add clarity. For example: `Prevent public repos on production`. |
| 47 | + |
| 48 | +### Enforcement status |
| 49 | + |
| 50 | +{% data reusables.enterprise.repo-policy-rules-enforcement %} |
| 51 | + |
| 52 | +### Allow list |
| 53 | + |
| 54 | +{% data reusables.enterprise.repo-policy-rules-allow-list %} |
| 55 | + |
| 56 | +### Targets |
| 57 | + |
| 58 | +Choose which organizations and repositories the policy applies to. |
| 59 | + |
| 60 | +#### Target organizations |
| 61 | + |
| 62 | +Select all organizations, choose a selection of existing organizations, or set a dynamic list by name. If you use {% data variables.product.prodname_emus %}, you can also choose to target all repositories owned by users in your enterprise. |
| 63 | + |
| 64 | +If you set a dynamic list, you'll add one or more naming patterns using `fnmatch` syntax. For example, the string `*open-source` would match any organization with a name that ends with `open-source`. For syntax details, see "[AUTOTITLE](/repositories/configuring-branches-and-merges-in-your-repository/managing-rulesets/creating-rulesets-for-a-repository#using-fnmatch-syntax)." |
| 65 | + |
| 66 | +#### Target repositories |
| 67 | + |
| 68 | +Choose which repositories (current or future) to target in the selected organizations. You can select all repositories or set a dynamic list by custom property. |
| 69 | + |
| 70 | +### Policies |
| 71 | + |
| 72 | +{% data reusables.enterprise.repo-policy-rules-policies-section %} |
| 73 | + |
| 74 | +## Further reading |
| 75 | + |
| 76 | +To set additional policies for repository management, see "[AUTOTITLE](/admin/enforcing-policies/enforcing-policies-for-your-enterprise/enforcing-repository-management-policies-in-your-enterprise)." |
0 commit comments