What is GitOps? It is an operating model in which a Git repository is the single source of truth for the desired state of your infrastructure and applications, and an automated agent continuously makes the live environment match what Git says. Changes are made by pull request, reviewed like any code, and applied by software instead of by a person running commands. This guide explains how GitOps works, how it differs from ordinary CI/CD, the main tools, and how to adopt it with Kubernetes and cloud platforms.
Short answer: GitOps stores the declared state of a system in Git and uses an agent inside the environment to pull and apply it, correcting any drift. You get a complete audit trail, easy rollbacks by reverting a commit, and a safer way to give many teams the ability to deploy.
What is GitOps?
The term was popularised by Weaveworks around 2017 and is now supported by a vendor neutral working group. It extends the ideas of infrastructure as code and DevOps with two principles: the desired state is declarative and versioned in Git, and approved changes are applied automatically and continuously. The Git article on Wikipedia explains the version control system on which it depends.
The four GitOps principles
| Principle | Meaning | Benefit |
|---|---|---|
| Declarative | The whole system is described as the state you want | Clear, reviewable intent |
| Versioned and immutable | Desired state lives in Git with full history | Audit trail and simple rollback |
| Pulled automatically | Agents pull approved changes from Git | Fewer credentials leave the cluster |
| Continuously reconciled | Agents detect and correct drift | Environments stay as declared |
How GitOps works

- Change the desired state. A developer opens a pull request that edits manifests, for example to use a new image version.
- Review and test. Colleagues review the change and automated checks validate it.
- Merge. The merge into the main branch is the approval. Git now holds the new desired state.
- The agent notices. A controller such as Argo CD or Flux sees that Git and the cluster differ.
- Reconcile. The agent applies the change and reports health and sync status.
- Correct drift. If someone changes the cluster by hand, the agent reverts it or raises an alert.
- Roll back. To undo a release, revert the commit and the agent restores the previous state.
GitOps compared with traditional CI/CD
| Aspect | Push based CI/CD | GitOps |
|---|---|---|
| How changes reach the cluster | Pipeline runs commands against the cluster | Agent inside the cluster pulls from Git |
| Credentials | Pipeline needs cluster access | Cluster reaches out, fewer exposed secrets |
| Drift handling | Not detected after deployment | Detected and corrected continuously |
| Source of truth | Pipeline scripts and the live cluster | Git repository |
| Rollback | Re-run an earlier pipeline | Revert a commit |
GitOps does not replace CI. A continuous integration pipeline still builds and tests the application and publishes an image. GitOps takes over at the delivery step, deciding what version runs where. See what is CI/CD.
Popular GitOps tools
| Tool | Notes |
|---|---|
| Argo CD | Visual interface, application sets and strong multi cluster support |
| Flux | Lightweight controllers built on Kubernetes primitives |
| Helm and Kustomize | Package and customise manifests for each environment |
| Terraform with a pipeline | Applies the GitOps approach to cloud resources. See what is Terraform |
| Sealed Secrets and external secrets operators | Keep secrets safe while still using Git |
Repository structure that scales
- Keep application source code and deployment configuration in separate repositories so each can change at its own pace.
- Use one folder or branch per environment, with shared bases and small overlays for differences.
- Protect the main branch and require review for production folders.
- Never commit plain text secrets. Use sealed or externally managed secrets.
- Use clear commit messages, because Git history is now your deployment history.
Benefits of GitOps
- Every change is traceable to a person, a review and a commit.
- Rollback is fast and reliable because earlier states are stored.
- Developers deploy using tools they already know, without cluster credentials.
- Recovery is simpler: point a new cluster at the repository and it rebuilds. See what is disaster recovery.
- Security improves because access to production is through reviewed changes. See what is DevSecOps.
Common GitOps mistakes
- Allowing engineers to keep changing the cluster by hand, which fights the agent.
- Mixing application code and environment configuration in a single, noisy repository.
- Committing secrets to Git.
- Skipping validation, so a typo in a manifest reaches production.
- Using GitOps for tasks that are not declarative, such as one off data migrations.
How to adopt GitOps step by step
- Start with Kubernetes. GitOps fits clusters naturally. See what is Kubernetes.
- Declare one application. Put its manifests or Helm values in a configuration repository.
- Install an agent. Deploy Argo CD or Flux and connect it to that repository.
- Enable automatic sync for non-production first. Observe behaviour before extending to production.
- Add checks. Validate manifests and run policy checks on every pull request.
- Introduce approvals for production. Use code owners and required reviewers.
- Monitor sync health. Alert when an application is out of sync. See what is observability.
Our DevOps service designs GitOps repositories and delivery pipelines, and our cloud migration service lands workloads on platforms that are ready for them.
Security and compliance with GitOps
| Concern | How GitOps helps | What you still need |
|---|---|---|
| Who changed production | Every change is a reviewed commit with an author | Branch protection and signed commits |
| Least privilege | Engineers need Git access, not cluster administrator rights | Role based access in the agent and the cluster |
| Audit evidence | Git history and pull request approvals form the record | Retention of that history for the required period |
| Secrets | Encrypted secrets can live safely beside manifests | A tested process for key rotation |
| Policy | Policy checks run on every pull request. See what is infrastructure as code | Clear ownership of policy rules |
For regulated industries this is a significant advantage. An auditor asking who approved a production change can be shown a pull request instead of a spreadsheet, and the same history proves the environment was running exactly the approved configuration at any past date.
Multi cluster and multi environment delivery
GitOps scales naturally across many clusters. A single repository can describe a base application and small overlays for development, staging and each production region. An agent in each cluster pulls only the folder meant for it. Promotion between environments becomes a pull request that copies a version from one folder to the next, which makes it easy to prove that what ran in staging is what reaches production. This is also useful for organisations that follow the approach in what is multi-cloud, because the same repository structure works on any cloud that runs Kubernetes.
A worked example: ten teams, one platform
A company has ten product teams deploying to a shared Kubernetes platform. Each team used to run its own scripts with cluster administrator rights, and a single wrong command once removed a production namespace. The platform team introduces GitOps. Each team owns a folder in a configuration repository, and an Argo CD agent applies only that folder to that team namespace.
Releases become pull requests that include the new image tag. Reviews take minutes and automated checks catch misspelled fields before merge. When a bad release causes errors, the team reverts one commit and service is restored in about two minutes. The platform team no longer hands out administrator rights, and auditors can see who approved every production change. The new discipline took a month to settle, mainly because engineers had to stop fixing things directly in the cluster.
Key takeaways
- GitOps makes Git the source of truth and uses agents to keep environments in sync.
- Changes happen by reviewed pull request and rollback means reverting a commit.
- Pull based delivery reduces exposed credentials and corrects drift automatically.
- It complements CI, which still builds and tests the software.
- Keep secrets out of Git and stop manual cluster changes.
Quick glossary
| Term | Meaning |
|---|---|
| Reconciliation | Continually making actual state match desired state |
| Drift | Live state that differs from what Git declares |
| Overlay | Environment specific changes layered on a shared base |
| Argo CD | A popular GitOps controller for Kubernetes |
| Manifest | A file declaring a Kubernetes resource |
Read next: What Is Container Orchestration? Kubernetes and Beyond · What Is a Service Mesh? Istio, Linkerd and How It Works · What Is Cloud Security? Shared Responsibility and Controls
Frequently asked questions
What is GitOps in simple terms?
GitOps means Git holds the desired state of your systems and software automatically keeps the real environment matching it. You change production by merging a pull request.
What is the difference between GitOps and DevOps?
DevOps is a broad culture and set of practices. GitOps is a specific way of applying them, using Git as the source of truth and automated reconciliation for delivery.
Is GitOps only for Kubernetes?
It is most common with Kubernetes, but the principles also apply to cloud infrastructure and other declarative systems.
What is the difference between Argo CD and Flux?
Both are GitOps controllers. Argo CD offers a rich interface and application management, while Flux is lightweight and composed of small controllers. Either is a sound choice.
How do secrets work in GitOps?
Plain secrets must never be committed. Teams use encrypted secrets that only the cluster can decrypt, or reference an external secrets manager.
Does GitOps replace CI/CD?
No. CI still builds and tests code and publishes artefacts. GitOps handles the delivery and keeps environments in sync.
How does rollback work with GitOps?
You revert the commit that introduced the problem. The agent sees the change and restores the previous state automatically.
What are the risks of GitOps?
Poor repository structure, secrets in Git and manual changes that fight the agent. Clear conventions and training prevent most problems.
