Overview
Git needs an identity (user.name and user.email) to record who authored and committed changes. If these aren’t set, git commit stops with:
Please tell me who you are
This guide shows quick fixes, per-repo vs global configuration, CI/container setups, and troubleshooting.
Quickstart (one-time setup)
Set your identity globally so all repositories can commit without prompting.
# Replace with your actual name and email
git config --global user.name "Your Name"
git config --global user.email "[email protected]"
# Verify
git config --global --get user.name
git config --global --get user.email
Now retry your commit.
Minimal working example
Reproduce the error and fix it in a fresh repository.
# 1) Create a test repo
mkdir demo && cd demo
git init
echo "hello" > file.txt
git add file.txt
# 2) This commit will likely fail if identity is unset
git commit -m "Initial commit"
# -> error: Please tell me who you are
# 3) Fix by setting identity (global)
git config --global user.name "Ada Lovelace"
git config --global user.email "[email protected]"
# 4) Re-try commit (re-add if needed)
git commit -m "Initial commit"
# -> success
# 5) Show effective values
git config --show-origin --get user.name
git config --show-origin --get user.email
Choosing scope: local, global, system
- Local applies to one repository. Global applies to your user account across repos. System applies machine-wide.
| Scope | Command example | Stored in | When to use |
|---|---|---|---|
| Local | git config --local user.email [email protected] | .git/config | Different identity for a specific repo |
| Global | git config --global user.email [email protected] | ~/.gitconfig | Default identity for your user account |
| System | sudo git config --system user.email ci@host | /etc/gitconfig | Base image or CI runner machine-wide |
Notes:
- Omit
--localbecause it’s the default when run inside a repo. --systemgenerally requires admin/root privileges.
Windows-specific notes
PowerShell quoting differs slightly; otherwise the commands are the same.
# PowerShell
git config --global user.name "Your Name"
git config --global user.email "[email protected]"
Global config is typically at %USERPROFILE%\.gitconfig.
CI and containers
In ephemeral environments, set identity at job start or bake it into the image.
# CI job step (Linux runners)
git config --global user.name "CI Bot"
git config --global user.email "[email protected]"
# Or machine-wide inside a container image (Dockerfile RUN step)
# RUN git config --system user.name "Container Bot" \
# && git config --system user.email "[email protected]"
For single commits without changing config, use environment variables:
GIT_AUTHOR_NAME="Release Bot" \
GIT_AUTHOR_EMAIL="[email protected]" \
GIT_COMMITTER_NAME="Release Bot" \
GIT_COMMITTER_EMAIL="[email protected]" \
git commit -m "Release: v1.2.3"
You can also override the author per commit:
git commit --author="Jane Doe <[email protected]>" -m "Fix: correct typo"
Multiple identities (work vs personal)
If you contribute to both work and personal projects, keep a global default and override per repository:
# Global default (personal)
git config --global user.name "Alex Person"
git config --global user.email "[email protected]"
# In your work repo, override locally
cd path/to/work-repo
git config user.name "Alex Person (Work)"
git config user.email "[email protected]"
Tip: Use git config --global includeIf to auto-apply settings by path if needed.
Verification and introspection
# Show effective values with their sources
git config --list --show-origin | grep -E "user\.name|user\.email"
# Get a single value with origin
git config --show-origin --get user.name
# Unset a value
git config --global --unset user.email
# Ensure Git refuses to guess identity (helps catch mistakes)
git config --global user.useConfigOnly true
If values are still missing, confirm you’re in the right repo and that no environment variables are overriding your config.
Common pitfalls
- Forgetting to set both fields: you must set user.name and user.email.
- Typos or invalid emails: some platforms require a verified or specific email (e.g., no-reply addresses).
- Setting only local config in a different repo: run
git configinside the repo needing the override. - Permission issues with
--system: may needsudoor Administrator. - CI/container resets: identity disappears between runs unless configured each time or baked into images.
- Environment overrides:
GIT_*variables can supersede config settings for a process. - Corporate hooks: pre-commit or server-side hooks may enforce specific domains; use the required address.
Performance notes
- Global or system configuration avoids repeatedly writing local configs across many repos.
- In CI, baking
--systemsettings into the base image removes per-job setup steps, speeding pipelines. - Reading config is fast; performance differences are negligible at runtime. Focus on reducing repeated setup work.
Troubleshooting checklist
- Did you set both user.name and user.email?
- Are you in the correct repository when using local config?
- Do
git config --list --show-originvalues match expectations? - Are environment variables like GIT_AUTHOR_EMAIL overriding your config?
- On CI/containers, is the config reset each run? Move to
--systemor reapply at job start. - On Windows, is your global file at
%USERPROFILE%\.gitconfigaccessible?
FAQ
Can I use a no-reply email? Yes. Set
user.emailto your no-reply address if your hosting provider supports it.How do I use different identities per repo? Set a global default, then override with
git config user.nameandgit config user.emailinside that repo.How do I fix just one commit without changing config? Use
GIT_AUTHOR_*andGIT_COMMITTER_*environment variables, orgit commit --author(author only).Where are these settings stored? Local:
.git/config; Global:~/.gitconfig(or%USERPROFILE%\.gitconfigon Windows); System:/etc/gitconfig.My commit still fails after setting identity. What else? Re-check for typos, verify
user.useConfigOnlyisn’t blocking missing keys, ensure CI runners don’t discard the home directory, and confirm no restrictive hooks are rejecting your email.