Skip to content
Latchkey

git config Command: Configure Git in CI

git config gets and sets configuration values that control Git behavior at the repo, user, or system level.

Fresh CI runners have no identity or credentials configured. Before a job can commit or authenticate, it usually sets user.email, user.name, and a credential helper.

Common flags

  • --global - write to the per-user config (~/.gitconfig) instead of the repo
  • --local - write to the repository config (the default)
  • --system - write to the system-wide config
  • --add <key> <value> - append a value to a multi-valued key
  • --get <key> - print the value of a key
  • --unset <key> - remove a key

Example

shell
# Set a bot identity so an automated commit succeeds
git config --global user.email "ci-bot@example.com"
git config --global user.name "CI Bot"
# Cache the token for pushes back to the remote
git config --global credential.helper store

In CI

Commits fail with "Please tell me who you are" until user.email and user.name are set. Use --global on ephemeral runners so the identity applies to every repo in the job. For pushes, configure credential.helper or use a tokenized remote URL.

Key takeaways

  • Set user.email and user.name before any automated commit, or Git refuses to commit.
  • --global is convenient on ephemeral runners since the job owns the whole environment.
  • credential.helper lets a job authenticate pushes without re-prompting.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →