Configuring Git Repositories for GitOps

Configuring Git repositories for GitOps

The first step when getting started with GitOps is configuring a Git repository. This step is necessary because in GitOps all system operations are driven by changes to one or more Git repositories.

When establishing these repositories, development teams have two options.

  • Monorepo: A single repository that stores the source code for all applications, services, and infrastructure code in the project.

  • Polyrepo: Multiple repositories that store the source code for a single application, service, or infrastructure code.

Monorepos

When using a monorepo, the entire body of source code is stored in a single repository. This may include the source code for multiple services and their respective infrastructure code. The benefit of this approach is that all of the system's code is located in a single repository where it can easily be pulled and viewed by anyone working on the project. However, monorepos can be more difficult to secure and configure with certain tools.

Polyrepos

Polyrepos devote an individual repository to each application, service, and infrastructure code for an entire system. When using polyrepos for GitOps, the infrastructure code related to all applications and services within the system is normally versioned within a single separate repository. Then, each application or service has an individual repository dedicated to the project. This approach benefits from the isolation it creates between different bodies of source code. Each individual repository can have unique security permissions, and it naturally prevents dependencies between the source code for different services.

Get hands-on with 1200+ tech skills courses.