Skip to content
Latchkey

git config --local: Usage, Options & Common CI Errors

git config --local stores settings that apply only to the current repository.

Use local config to scope a bot identity, credential, or option to one checkout without leaking it to the whole runner. Local always wins over global and system.

What it does

git config --local reads and writes the repository config at .git/config, which takes precedence over --global and --system for that repository only.

Common usage

Terminal
git config --local user.email "bot@example.com"
git config --local core.autocrlf false
git config --local --get remote.origin.url
git config --local --list

Options

FlagWhat it does
--localUse the repository .git/config (default in a repo)
--get <key>Read a value
--unset <key>Remove a value
--listShow settings from this scope
--show-originReveal which file a value comes from

Common errors in CI

fatal: --local can only be used inside a git repository - you ran it before cloning or in the wrong directory. Remember precedence: local overrides global, so a stray local user.email shadows the global one; use --show-origin to find which file a surprising value lives in.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →