File Location
Repository settings are stored in the.github/repos/ folder of your admin repository, with one YAML file per repository:
The filename must match the repository name exactly:
<repo-name>.yml or <repo-name>.yamlWhen to Use Repo Settings
Use repository-specific settings when:- A repository has unique requirements that differ from team defaults
- You need to exempt a critical repository from standard policies
- You want to enforce stricter controls on high-value repositories
- A repository requires special branch protection, teams, or features
Repo settings have the highest precedence and will override any org-level or suborg-level configuration.
Basic Structure
Repo configuration files follow the same structure as org and suborg settings:.github/repos/api-gateway.yml
Repository-Specific Features
Repo settings include two special features not available at other levels:Force Create
Automatically create the repository if it doesn’t exist:.github/repos/new-project.yml
Template Repository
Create repositories from a template:.github/repos/new-service.yml
The
template field is used with force_create to specify which template repository to use when creating the new repository.Complete Examples
- Production API
- Experimental Project
- Public Open Source
- New from Template
.github/repos/api-gateway.yml
Overriding Patterns
Override Specific Settings
You only need to specify the settings you want to override:Disable Settings with Null
Set settings tonull to explicitly disable them:
.github/repos/legacy-project.yml
Add Additional Teams
Teams are merged, not replaced:.github/repos/cross-team-project.yml
Renaming Repositories
Using Safe Settings to Rename
To rename a repository using Safe Settings, rename the repo config file:- Detect the file rename
- Rename the repository in GitHub
- Use the new name going forward
Manual Renames
By default, Safe Settings ignores manual renames (for backward compatibility). To prevent manual renames:- Manual renames are reverted automatically
- Bot-initiated renames are allowed
- Safe Settings copies
old-repo.ymltonew-repo.yml(if new file doesn’t exist)
Working with Status Checks
You can allow status checks to be defined outside of Safe Settings:.github/repos/dynamic-checks.yml
.github/repos/dynamic-checks.yml
How externally defined status checks work
How externally defined status checks work
- For new branch protection/rulesets: Deployed with no status checks initially
- For existing configurations: Existing status checks remain unchanged
- Status checks can be added/modified via GitHub UI
- If you remove
{{EXTERNALLY_DEFINED}}, checks revert to Safe Settings configuration
Configuration Tips
Start Minimal
Only define settings that need to differ from org/suborg defaults. This keeps configs maintainable.
Use Comments
Document why specific overrides exist:
Group Related Settings
Keep related settings together for readability. Add blank lines between major sections.
Test in PR
Always test repo config changes in a PR. Safe Settings will run in dry-run mode and show you what will change.
Validation
Repo-level settings are subject to validation rules defined in your deployment settings:deployment-settings.yml
What happens if validation fails?
What happens if validation fails?
If a repo config fails validation:
- The PR check will fail with an error message
- The settings will not be applied
- The error will be shown in the check run and PR comment
- You must fix the invalid configuration before merging
Troubleshooting
My repo settings aren't being applied
My repo settings aren't being applied
Check:
- Is the filename exactly
<repo-name>.ymlor<repo-name>.yaml? - Is the YAML valid? Use a YAML validator.
- Check the Safe Settings check run in the admin repo for errors.
- Is the repository in the restricted repos list?
Getting validation errors
Getting validation errors
Your repo config may be violating an override validator. Check your
deployment-settings.yml for validators that prevent certain overrides. The error message will indicate which validator failed.Settings from suborg are missing
Settings from suborg are missing
Repo settings are merged with suborg and org settings. If you explicitly set a value to
null or override it, the suborg value will not be used. Review your merge hierarchy.Repository not being created with force_create
Repository not being created with force_create
Ensure:
force_create: trueis set- You’ve pushed to the default branch (not a PR)
- Safe Settings has permissions to create repositories
- Check Safe Settings logs for errors
Best Practices
- Use Sparingly - Only create repo configs when truly needed. Most repos should use org/suborg defaults.
-
Document Exceptions - Add comments explaining why a repo needs special treatment:
-
Leverage CODEOWNERS - Ensure the right team approves changes:
- Regular Reviews - Periodically review repo configs to see if they can be consolidated into suborg configs.
- Test First - Always create a PR to test changes before applying them.
Next Steps
Configuration Hierarchy
Understand how repo settings merge with org and suborg settings
Deployment Settings
Configure validators and restrictions
Sample Repo Config
View sample repository configuration
Status Checks
Learn about status check inheritance