Course contentsShow
← Cloud and Infrastructure
Lesson 1856 of 2,98939. GitOps PrinciplesFree lesson

Git as Single Source of Truth

How Git repositories serve as the authoritative state for infrastructure and applications.

Git as Single Source of Truth

What you'll learn: How Git repositories serve as the authoritative reference for all infrastructure and application state in GitOps workflows.

The Core Principle

In GitOps, the Git repository becomes the single source of truth for your entire system's desired state. This means every configuration file, infrastructure definition, application manifest, and policy lives in Git—and what's in Git is what should be running in your environment. If something exists in production but not in Git, it's considered drift. If something's in Git but not in production, the system should converge to match Git.

Think of Git as your "master blueprint" for a building. Architects don't store the official plans in emails, sticky notes, or someone's memory—they keep one authoritative set of blueprints. Similarly, GitOps treats Git as the definitive record of how everything should look.

Why This Matters

When Git is your single source of truth:

  • Auditability: Every change has a commit history showing who changed what and when
  • Rollback capability: Reverting to a previous state means reverting a Git commit
  • Consistency: Teams don't argue about "what's actually deployed"—Git answers that definitively
  • Disaster recovery: Lost a cluster? Recreate it entirely from Git
  • Access control: Git permissions determine who can change production

Instead of manually SSHing into servers, running kubectl apply, or clicking through cloud consoles, operators propose changes via pull requests. Once merged, automated agents synchronize the live environment to match Git's declared state.

The Contract

Git doesn't just describe your infrastructure—it defines it. The live environment becomes a reflection of Git, not the other way around. This inversion is powerful: you're no longer managing infrastructure directly; you're managing declarative files in version control.

Key Takeaway: In GitOps, Git repositories are the authoritative definition of your system's desired state—making them the central coordination point for all infrastructure and application changes.