What is GitOps?

In short
GitOps is a way to manage infrastructure and applications by keeping their desired state in a Git repository. Software agents read that state and make the live system match it. Git becomes the single source of truth for how systems should look.
GitOps is an operating approach for running software and infrastructure. The core idea is simple. You describe the state you want your systems to be in, store that description in Git, and let automated tools keep the live environment in line with it. Git is the place where changes are proposed, reviewed and recorded.
The core principles
The OpenGitOps project, a set of open-source standards and community education on GitOps, describes four principles. The first is that the desired state is declarative. You describe the result you want, not the step-by-step commands to reach it. The second is that the desired state is versioned and immutable. Its storage enforces a complete history, so every past version can be inspected.
The third principle is that software agents pull the desired state from its source. Instead of a pipeline pushing changes into a server, an agent running in or near the environment fetches the declarations and applies them. The fourth principle is that the agents continuously check the live system against the desired state and correct drift when they find a difference.
These ideas are standards rather than a single product. Several tools implement them, and the project publishes training and certification for people who want to learn the approach in depth.
How it works in practice
A typical GitOps setup has two kinds of content. The first is the application code, which lives in one repository. The second is the configuration that describes how that code should run, such as which version to deploy, how many copies to start and which settings to use. Many teams keep the configuration in a separate repository.
When someone wants to change production, they do not log in to the server and edit it by hand. They open a pull request that changes the configuration file. The team reviews the change, and once it is merged, the agent notices the new desired state and updates the live system. If someone changes the live system by hand, the agent sees the difference and reverts it to match Git.
This gives you a clear audit trail. Each change has an author, a review and a commit. Rolling back is often as simple as reverting a commit, because the previous state is still in the history.
When to use it
GitOps fits best when you manage many services, clusters or environments and want consistent results across them. It is especially common with container platforms such as Kubernetes, where the desired state can be written as declarative files. Teams that already use Git for code review will find the workflow familiar.
It may be less useful for a single small site with one server that rarely changes. The extra setup of agents and repository layout may not pay off there. Also remember that GitOps depends on good discipline. If people keep making manual changes outside Git, the agent will fight them, and the benefits of a single source of truth are lost.
A simple example
Imagine a repository that holds a file describing a web service. The file says which container image to run and how many replicas to keep. To release a new version, an engineer edits the image tag and opens a pull request. After review and merge, an agent in the target cluster sees the new tag and rolls out the change. If the rollout causes problems, the team reverts the commit and the agent restores the previous state.
The key point is that the file, not a person at a terminal, is the record of what should be running.
Common mistakes
A common mistake is storing secrets such as passwords in plain text inside the repository. Anyone with read access to Git can then see them, so teams usually use a dedicated secrets approach instead.
Another mistake is treating the agent as optional and still applying changes by hand. This creates drift that the agent will undo, which can surprise people during an incident. A third mistake is putting too much into one repository, which makes reviews slow and access control hard. Splitting configuration by environment or team often helps.
Finally, do not confuse GitOps with simply running scripts from a CI pipeline. The defining feature is that an agent pulls and reconciles state continuously, not that a job runs once after a commit.
Alternatives
Traditional push-based deployment, where a CI pipeline connects to servers and runs commands, is simpler to start with. It is often enough for small projects. Infrastructure-as-code tools that apply configuration on demand are another option. They are useful, but they do not usually watch the live system for drift between runs.
GitOps is best seen as a pattern that combines Git, declarative configuration and automated reconciliation. You can adopt parts of it gradually, for example by storing configuration in Git before adding an agent.
FAQ
Is GitOps the same as Git?
No. Git is the version control system that stores the files. GitOps is an approach that uses Git as the source of truth for the desired state of systems, along with agents that apply that state automatically.
Do I need Kubernetes to use GitOps?
Not strictly, but GitOps is most common with Kubernetes because its resources are described declaratively. The principles apply to any system whose desired state can be written down and reconciled automatically.
What is the difference between push and pull deployment?
In push deployment, a pipeline connects to the target and makes changes. In pull deployment, an agent inside or near the target fetches the desired state from the source and applies it.
Where can I learn GitOps in more depth?
The OpenGitOps project lists community training, including courses on fundamentals and Argo CD, and a GitOps Associate certification. Start with the official site to see what is currently offered.
Sources
This page is based on the official documentation below. Read it for full detail.
GitOps — official documentation ↗