GitOps Repository Structure
What You'll Learn
You'll learn how to organize your Git repositories to cleanly separate application source code from deployment configurations for effective GitOps workflows.
The Separation Principle
In GitOps, repository structure matters. The golden rule: keep your application code separate from your deployment manifests. Think of it like keeping your recipe (how to build the app) separate from your meal plan (how to deploy it). They change at different rates and for different reasons.
Common Repository Patterns
Mono-Repo Approach
Everything lives in one repository, but in clearly separated directories:
my-app/
├── src/ # Application code
├── manifests/ # Kubernetes YAML, Helm charts
└── config/ # Environment-specific configs
Multi-Repo Approach (Recommended)
Application and deployment manifests live in separate repositories:
- App repo: Source code, Dockerfile, unit tests
- Config repo: Kubernetes manifests, Helm values, environment configs
This pattern prevents application developers from accidentally triggering deployments and allows different teams to own different concerns.
Why Separate?
Different lifecycles: Your app might deploy 10 times a day, but infrastructure configs change weekly. Mixing them creates noise and confusion.
Clear ownership: Developers own app repos; platform/ops teams own config repos. Each team can set appropriate access controls.
Security boundaries: Deployment credentials never touch application code repositories.
Audit trails: Git history clearly shows what changed in your running systems versus what changed in your codebase.
Key Takeaway: Effective GitOps separates application source code from deployment manifests—typically using distinct repositories—to establish clear ownership, security boundaries, and change tracking for both development and operations workflows.