Git Configuration
The git section in atmos.yaml makes Git a foundational Atmos capability — a peer to Toolchain, Auth, and Hooks. Define managed repositories once under git.repositories, then clone, pull, diff, commit, and push them by logical name from the atmos git commands, kind: git lifecycle hooks, and native CI workflows — with consistent authentication, safety rules, and workdir handling. It is the foundation for GitOps workflows with Atmos: commit generated artifacts to a source-of-truth repository that Argo CD, Flux, or your CI consumes.
You will learn
- Define managed repositories by logical name under
git.repositories - Authenticate through Atmos Auth identities and integrations — credentials are never embedded in URIs
- Clone is always reconcile: idempotent and safe under restored CI caches
- Automatic workdirs under the Atmos XDG cache root are captured by the native CI cache for free
- Configure local Git hooks (
pre-commit,commit-msg, ...) that delegate to Atmos workflows
Basic Configuration
The keys under git.repositories (flux-deploy, generated-terraform) are arbitrary, user-defined logical names — not reserved values. Components, hooks, and commands refer to repositories by these names. Repository configuration follows standard Atmos deep-merge, so repositories can be defined in imported configuration and overridden per environment.
Repository Fields
All fields a repository supports:
providerExecution backend for Git operations. Default and currently the only value:
cli(shells out to the Git CLI).cliis host-agnostic — it works with GitHub, GitLab, Bitbucket, and bare repositories.uriRemote repository URI. Credentials must never be embedded in
uri— authentication flows through the process environment and Atmos Auth, never through URL rewriting with tokens.branchBranch to check out. Empty means the current branch for existing workdirs, and Git's default-branch behavior for fresh clones.
remoteRemote name. Default:
origin.workdirExplicit workdir location, overriding the automatic XDG location (see Automatic Workdirs).
clone.depthShallow clone depth.
0(default) means full history. Also settable per invocation with--depth(flag wins: CLI > ENV > config > defaults).clone.filterPartial-clone filter spec (for example,
blob:none). Also settable per invocation with--filter.clone.single_branchLimit the clone to the configured branch. Also settable per invocation with
--single-branch.clone.submodulesInitialize submodules after clone. Default:
false.auth.identityThe Atmos Auth identity used for Git operations against this repository. See Authentication Resolution.
commit.signingCommit signing mode:
auto(default — pass no signing flag; Git config decides),always(pass-S), ornever(pass--no-gpg-sign). Overridable per invocation with--sign/--no-sign.commit.author.name/commit.author.emailCommit author identity, passed per invocation (
-c user.name=... -c user.email=...) without mutating repository or global Git config. Required in CI, where runners typically have nouser.name/user.emailconfigured. Locally, when Git already resolves an author, Atmos passes nothing — your own Git config wins.push.retriesBounded retry count for rejected non-fast-forward pushes (
pull --rebase, then re-push). Default:3.0disables retries.init.fromDefault seed source for
atmos git init— the repository URI whose content bootstraps this repository (a template, or a repository being migrated). When omitted,initcreates an empty repository. Overridable per invocation with--from(flag wins: CLI > ENV > config > defaults).init.keep_historyWhen seeding via
init.from, preserve the source's full history and keep it reachable as theupstreamremote so future updates can be pulled. Default:false(fresh history — a single initial commit). Only valid together withinit.from. Overridable per invocation with--keep-history.
Defaults
When fields are omitted:
| Field | Default |
|---|---|
provider | cli |
remote | origin |
branch | Current branch for existing repos; Git default-branch behavior for clone |
workdir | Automatic XDG cache location (see below) |
commit.signing | auto |
commit.author | Identity-derived when available; otherwise an atmos[bot]-style default |
push.retries | 3 |
clone.depth | 0 (full history) |
clone.submodules | false |
Automatic Workdirs
When workdir is omitted, Atmos resolves a deterministic location under the Atmos XDG cache root:
$XDG_CACHE_HOME/atmos/git/repositories/<name>
with the standard XDG fallbacks and ATMOS_XDG_* overrides. Because the native CI cache archives the XDG cache root, managed clones are captured and restored across CI runs for free. An explicit workdir overrides the automatic location.
Clone Destinations
The two-repo split (managed repositories vs. the current repository) extends to clone destinations:
| Clone form | Destination |
|---|---|
Named managed repository (atmos git clone flux-deploy) | Automatic XDG workdir (cache-captured) |
Single configured repository outside CI (atmos git clone with exactly one repository) | Automatic XDG workdir (cache-captured) |
No-arg current-repo checkout replacement in CI (atmos git clone with ci.enabled: true and detected CI metadata) | The working directory (e.g., GITHUB_WORKSPACE), exactly like actions/checkout — never an XDG workdir; subsequent Atmos commands expect the repo at CWD |
Ad hoc URI (atmos git clone https://...) | <cwd>/<repo-name>, like plain git clone |
--workdir=<path> overrides the destination in all forms.
Clone Is Reconcile
Workdirs persist across runs — and the native CI cache restores them, possibly stale. Clone semantics are therefore defined as reconcile, not "fail if exists":
- Workdir absent → clone.
- Workdir present and clean → fetch, check out the configured branch, fast-forward to the remote ref.
- Workdir present and dirty from a crashed or interrupted run → defined recovery: discard uncommitted changes inside managed paths only and re-reconcile; fail with a hint when unmanaged dirty files are present.
Reconcile makes clone behavior independent of cache freshness: a cache hit means fetching the delta instead of a full clone; a cache miss means a fresh clone; correctness is identical either way.
Authentication Resolution
auth.identity is the only named auth reference on a repository. Integrations are never referenced by name from git config — they attach to identities via their via link, and naming an identity on a repository brings its integrations along automatically. For example, a github/sts integration linked to platform-admin materializes GIT_CONFIG_* credentials for every Git subprocess targeting the repository, with zero Git-specific auth wiring:
Per-operation resolution order:
--identity=<name>flag (the global persistent flag).git.repositories.<name>.auth.identity.- Ambient credential broker: when no identity is configured, the lazy ambient broker runs before the first Git subprocess. This is the zero-config CI path —
atmos git cloneof a private GitHub repository works with noauthblock at all when an auto-provisiongithub/stsintegration (or an ambientGITHUB_TOKEN) is available. - Process environment passthrough: your own Git credentials (credential helpers, SSH agent) always work, since the Git CLI provider inherits the process environment.
See Authentication for identities and integrations.
Local Git Hooks
The git.hooks section maps Git hook names to commands, executed via thin .git/hooks/* shims installed by atmos git hooks install:
git.hooks.<hook-name>A Git hook name:
pre-commit,commit-msg,pre-push, and so on.git.hooks.<hook-name>.commandThe command to execute when the hook fires. Hook commands should usually invoke an Atmos workflow or custom command, which preserves existing toolchain, environment, and identity behavior. Hook arguments and stdin are forwarded.
Local Git hooks are triggered by Git itself in the current repository. They are separate from Atmos lifecycle events — for event-bound Git publishing (e.g., commit after terraform apply), use the kind: git hook.
List Output
The git.list section configures atmos git list output, following the established <section>.list.columns pattern:
git.list.formatDefault output format:
table,json,yaml,csv, ortsv.git.list.columnsColumn definitions (
name+valuetemplate). Available row fields:name,uri,provider,branch,workdir, andstatus(populated only with--check-status). Custom columns also feed dynamic tab completion for--columns.
Native CI Lifecycle
With ci.enabled: true, Git composes with the native CI cache and Atmos Auth into a complete job lifecycle:
- Job starts. CI cache auto-restore brings back the Atmos XDG cache root — toolchain binaries and managed-repo Git workdirs from the previous run.
atmos git clone(no-arg) puts the current repository in the workspace, replacingactions/checkout. Fetch-depth guidance applies whenatmos describe affectedwill run against this clone.atmos git clone --allreconciles the restored XDG workdirs: a cache hit fetches the delta instead of performing a full clone; a cache miss performs a fresh clone.- First Git subprocess triggers the ambient broker — GitHub STS materializes
GIT_CONFIG_*credentials for Git subprocesses. - Operations run: render, publish, commit, push (with retry).
- Command end: the CI cache pending-save archives the XDG root for the next run.
A minimal GitHub Actions job replacing actions/checkout + actions/cache glue:
Cache restore/save and STS credential minting happen inside the Atmos commands — no actions/checkout, actions/cache, or token-wiring steps.
Git workdirs change on every publish, so they churn cache archives. This is safe — workdirs are regenerable and always reconciled. To keep archives lean, scope ci.cache.paths to exclude git/repositories/, trading cache hits for full clones. atmos git list --check-status shows what is currently materialized under the cache root.
Related
atmos git— the command groupkind: githooks — publish artifacts on lifecycle events- Authentication — identities and integrations
- CI Configuration — native CI detection and cache