Skip to content

Git & Version Control: CGOA practice questions

Git and version control matter in GitOps because the repository is the state store, and the OpenGitOps glossary asks a state store for three things: immutable versions of the desired state, access control, and auditing of changes. Most Git practices in this topic are ways of meeting those requirements.

By Ibrahim Yesilay · Published · Updated

Independent community practice, not affiliated with or endorsed by CNCF or The Linux Foundation.

What Git & Version Control covers in CGOA

Git and version control matter in GitOps because the repository is the state store, and the OpenGitOps glossary asks a state store for three things: immutable versions of the desired state, access control, and auditing of changes. Most Git practices in this topic are ways of meeting those requirements.

History is the audit trail. Every commit records an author, a time and the exact change, so questions such as what changed before an incident and who approved it are answered from the log. Because commits are versioned rather than overwritten, rolling back is a matter of reverting to an earlier version and letting the agent reconcile.

Access control is enforced at the repository, and repository layout is part of it: Flux's guide on repository structure describes a dedicated production repository as a way to limit the scope of changes and who may make them.

Repository structure has several accepted shapes, and the Flux guide names four. A monorepo stores all Kubernetes manifests in one Git repository, with environments as directories on the same branch such as main. A repository per environment isolates production. A repository per team lets a platform team own shared infrastructure while application teams own their configuration. A repository per application keeps the source code and its deployment manifests together, with the fleet configuration pointing at them. The same guide favors trunk-based development, where branches besides main are short-lived; long-lived per-environment branches are a possible design, but not the one the Flux examples use.

Signed commits add provenance. Flux's GitRepository has an optional verify field that checks OpenPGP or SSH signatures against a Secret holding the public keys of trusted authors. Mode HEAD verifies the commit at the checked-out reference, Tag verifies the tag object, and TagAndHEAD verifies both. If verification fails, the source is not marked verified and the controller keeps retrying with exponential backoff instead of producing an artifact.

Pinning references keeps history meaningful. A GitRepository can track a branch, a tag, a semver range or a specific commit, and a commit takes precedence over the other fields. Argo CD's best practices warn that pointing at HEAD of a remote base is not a stable target and recommend a tag or commit SHA.

Secrets are the exception to storing everything in Git. Kubernetes warns that checking a Secret manifest into a repository makes the value available to everyone who can read it, and that base64 is not encryption. Keep secrets out of the repository, or store only an encrypted form such as a SealedSecret.

Key points

  • A state store must provide immutable versions, access control and auditing; Git history is the audit trail.
  • Flux describes four repository layouts: monorepo, repo per environment, repo per team and repo per application.
  • Flux GitRepository spec.verify checks OpenPGP or SSH commit and tag signatures in HEAD, Tag or TagAndHEAD mode.
  • Base64 in a Secret manifest is not encryption; a committed Secret is readable by everyone with repository access.

Three sample questions

8 CGOA questions on Git & Version Control, 8 with explanations. How practice works

Question 1

What Git feature is essential for GitOps auditability?
  1. A.Git hooks with pre-commit validation and automated policy enforcement mechanisms
  2. B.Commit history and blame
  3. C.Git submodules with nested repository management and dependency tracking capabilities
  4. D.Git LFS (Large File Storage) with binary asset versioning and distributed storage management

Correct answer: B

Git's commit history provides a complete audit trail of who made what changes when, which is crucial for compliance, debugging, and understanding system evolution in GitOps.

Question 2

How should secrets be handled in a GitOps repository?
  1. A.Secrets should never be stored in Git and must be managed through external secret management systems with encryption and access controls
  2. B.Plain text storage with basic file permissions and simple access restriction mechanisms
  3. C.Encoded in base64 format with minimal encryption and standard repository access controls
  4. D.Environment variables with limited rotation and basic security implementation practices

Correct answer: A

Secrets should never be committed to Git repositories. They should be managed through dedicated secret management tools like HashiCorp Vault, Kubernetes Secrets, or cloud provider secret services.

Question 3

What is the primary benefit of using branches in GitOps workflows?
  1. A.Feature isolation, testing environments, and controlled integration with comprehensive change validation processes
  2. B.Code backup with simple versioning and basic restoration capabilities for development teams
  3. C.Developer separation with limited collaboration and basic workspace management for individual contributors
  4. D.Version numbering with sequential tracking and minimal branching strategy for release management

Correct answer: A

Branches in GitOps workflows provide feature isolation, enable testing in separate environments, allow parallel development, and facilitate controlled integration through pull requests and reviews.

Practice this topic

Focus mode keeps every question on Git & Version Control until you leave it. 10 free guest answers, then a free account; no credit card.

Or open CGOA practice across all topics.

Sources

The explanation above was checked against these official documents.