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 storeIn 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
git push Command: Publish Refs in CIgit push uploads commits and tags to a remote. Reference for --tags, --follow-tags, and --force-with-lease as…
git clone Command: Clone Repos in CIgit clone copies a remote repository into a new directory. Reference for --depth, --branch, --filter, and --r…
git remote Command: Manage Remotes in CIgit remote manages the set of tracked repositories. Reference for -v and set-url, used in CI to inspect or re…
git submodule update Command in CIgit submodule update fetches and checks out submodules. Reference for --init, --recursive, --depth, and the s…