Skip to main content

atmos git hooks run

Execute the command or ordered steps configured for a Git hook under git.hooks. This is what the .git/hooks/* shims installed by atmos git hooks install invoke, but it can also be run directly — useful for testing a hook without triggering it through Git.

atmos git hooks run --help
 

Usage​

atmos git hooks run <hook-name> [args...]

Given this configuration:

git:
hooks:
pre-commit:
command: atmos workflow pre-commit
commit-msg:
command: atmos workflow commit-msg -- "$1"

Git invokes the installed shim, which runs:

atmos git hooks run commit-msg .git/COMMIT_EDITMSG

Examples​

# Test a hook without committing
atmos git hooks run pre-commit

# Run a hook that takes arguments (commit-msg receives the message file path)
atmos git hooks run commit-msg .git/COMMIT_EDITMSG

Behavior​

  • Loads the Atmos configuration for the current repository and selects the hook's command or steps.
  • Runs steps in order through the registered step library. Embedded Starlark runs inside Atmos; a failed step stops the hook. Hook arguments are available as ctx.args.
  • Runs command hooks through the shared shell runner with the inherited process environment, including PATH. Prepare any tools or identity credentials before invoking the hook.
  • Forwards hook arguments and stdin to command hooks — hooks such as pre-push and pre-receive receive their input on stdin, not argv. For steps hooks, stdin handling depends on the step type.
  • Propagates the command's exit code, so a failing hook command blocks the Git operation exactly as a hand-written hook would.
  • Fails with a clear error listing the configured hooks when <hook-name> is not configured under git.hooks.

Arguments​

hook-name (required)

The Git hook to run, matching a key under git.hooks (pre-commit, commit-msg, pre-push, ...).

args... (optional)

Arguments forwarded verbatim to the configured command — exactly what Git passes to the hook (for example, the commit message file path for commit-msg). Arguments are passed through even when they look like flags.

For inline scripts and execution details, see Git hook steps.