Skip to main content

!git.root

The !git.root Atmos YAML function returns the absolute root directory of the current Git worktree. It is an alias of !repo-root — both resolve identically.

Availability and evaluation​

Supported locations:

  • CLI configuration (atmos.yaml, atmos.d, and profiles): during configuration loading.
  • Resolved stack values: after inheritance, merging, and component template processing.
  • Scaffold manifests: during manifest loading.

Automatic evaluation requires native YAML tags from edition 2026-10-20, including unpinned projects. Quoted function strings remain literal; earlier editions retain legacy string-form behavior.

See YAML function scope for field restrictions, import timing, and native tags versus quoted strings.

Usage​

# Get the root directory of the current Git repository.
# If the Git root cannot be resolved, it returns a default value if specified; otherwise, it returns an error.
!git.root <default-value>

Examples​

vars:
base_path: !git.root

# With a fallback value if the Git repository root is not present.
base_path_safe: !git.root <default-value>
  • !repo-root — identical function, kept for naming-convention consistency with the other !git.* functions