KhueApps
Home/DevOps/Fix Git error "Please tell me who you are" (set user.name/email)

Fix Git error "Please tell me who you are" (set user.name/email)

Last updated: October 07, 2025

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.
ScopeCommand exampleStored inWhen to use
Localgit config --local user.email [email protected].git/configDifferent identity for a specific repo
Globalgit config --global user.email [email protected]~/.gitconfigDefault identity for your user account
Systemsudo git config --system user.email ci@host/etc/gitconfigBase image or CI runner machine-wide

Notes:

  • Omit --local because it’s the default when run inside a repo.
  • --system generally 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 config inside the repo needing the override.
  • Permission issues with --system: may need sudo or 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 --system settings 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

  1. Did you set both user.name and user.email?
  2. Are you in the correct repository when using local config?
  3. Do git config --list --show-origin values match expectations?
  4. Are environment variables like GIT_AUTHOR_EMAIL overriding your config?
  5. On CI/containers, is the config reset each run? Move to --system or reapply at job start.
  6. On Windows, is your global file at %USERPROFILE%\.gitconfig accessible?

FAQ

  • Can I use a no-reply email? Yes. Set user.email to 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.name and git config user.email inside that repo.

  • How do I fix just one commit without changing config? Use GIT_AUTHOR_* and GIT_COMMITTER_* environment variables, or git commit --author (author only).

  • Where are these settings stored? Local: .git/config; Global: ~/.gitconfig (or %USERPROFILE%\.gitconfig on Windows); System: /etc/gitconfig.

  • My commit still fails after setting identity. What else? Re-check for typos, verify user.useConfigOnly isn’t blocking missing keys, ensure CI runners don’t discard the home directory, and confirm no restrictive hooks are rejecting your email.

Series: Git

DevOps