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 --listOptions
| Flag | What it does |
|---|---|
| --local | Use the repository .git/config (default in a repo) |
| --get <key> | Read a value |
| --unset <key> | Remove a value |
| --list | Show settings from this scope |
| --show-origin | Reveal 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
git config --global: Usage, Options & Common CI Errorsgit config --global sets user-wide Git settings in ~/.gitconfig. Reference for identity, safe.directory, and…
git config: Usage, Options & Common CI Errorsgit config gets and sets Git configuration at system, global, and local scope. Reference for --global, --get,…
git remote add: Usage, Options & Common CI Errorsgit remote add registers a new named remote URL. Reference for -f, -t, --tags, and the "remote already exists…
git init: Usage, Options & Common CI Errorsgit init creates a new empty Git repository or reinitializes an existing one. Reference for --bare, --initial…