Getting Started
Prerequisites
Section titled “Prerequisites”- gh CLI installed and authenticated (
gh auth login) - Repositories you want to manage must be accessible with your current
ghtoken
Installation
Section titled “Installation”gh extension install babarot/gh-infraRecommended. Installs as a gh subcommand — run gh infra plan, gh infra apply, etc. Authentication is shared with gh auth, so no additional token setup is needed.
brew install babarot/tap/gh-infraInstalls as a standalone binary. Run as gh-infra plan directly. Note that gh CLI is still required as gh-infra uses it internally for GitHub API calls.
go install github.com/babarot/gh-infra/cmd/gh-infra@latestBuild from source. Installs as a standalone binary, same as Homebrew.
Verify the installation:
gh infra --helpQuick Start
Section titled “Quick Start”-
Import an existing repository
Start by exporting a repository’s current settings to YAML:
Terminal window gh infra import babarot/my-project > repos/my-project.yamlThis generates a complete YAML manifest reflecting the repository’s current state on GitHub.
-
Edit the YAML
Open the file and change what you want. For example, enable discussions, disable wiki, and add topics:
apiVersion: gh-infra/v1kind: Repositorymetadata:name: my-projectowner: babarotspec:description: "My awesome project"visibility: publictopics:- go- clifeatures:issues: trueprojects: falsewiki: falsediscussions: true -
Preview changes
Run
planto see what would change without making any modifications:Terminal window gh infra plan ./repos/~ babarot/my-project 2 to update~ features~ wiki true → false~ discussions false → true~ topics [] → [go, cli]Plan: + 0 to create ~ 2 to update - 0 to destroyin 1 repository -
Apply
When you’re happy with the plan, apply:
Terminal window gh infra apply ./repos/gh-infra will show the plan again and ask for confirmation before making changes.


What’s Next?
Section titled “What’s Next?”gh-infra supports four resource kinds:
| Kind | What it does |
|---|---|
| Repository | Manage a single repo’s settings |
| RepositorySet | Manage many repos with shared defaults |
| File | Manage files in a single repo |
| FileSet | Distribute files (LICENSE, CODEOWNERS, workflows) across repos |
See the Resources for the full specification, or check out the Guides for different usage patterns.
To run gh-infra in GitHub Actions (plan each pull request with a comment, apply on merge, detect drift on a schedule), see CI/CD Integration.