Skip to main content
DevOps Insightsguides & answers

Git · troubleshooting

*** Please tell me who you are

Git needs a name and email for every commit and none is configured for this user, which is normal in fresh containers and CI runners. Set user.name and user.email with git config, either for every repository on this machine (--global) or for this repository only, and commit again.

Reproduced on Git 2.50.1, . Where the text says “reproduced”, the behaviour was run on that version, not taken from documentation.

First published

New to this? Read what is actually happening first, then come back to the steps.

On this page · 9 sections

Before you start

  • A terminal in the repository, as the user that will commit.

Run this first

step 1 of 1
git config --show-origin --get-all user.email

Look for Nothing (not set), or an unexpected file

Shows the email Git would use and which file it comes from.

Work out which cause you have

A few questions to narrow the list. Every answer ends in a command that confirms or rules the cause out — this cannot see your cluster, so nothing here is a certainty until you have checked.

Narrow it down

0 answered · nothing is sent anywhere

Where are you committing?

Cause space

2 of 2 still possible

  • No identity configured on this machine or userCommon
  • A CI job or container commitsCommon

Nothing ruled out yet. Answer the question above and the branches your answer eliminates will strike through here.

Or diagnose it manually

In this order. The first command usually contains the whole answer.

  1. Step 1

    git config --show-origin --get-all user.email

    Shows the email Git would use and which file it comes from.

    Look for Nothing (not set), or an unexpected file

Every cause, and how to fix it

Ordered by how often each one turns out to be the answer.

No identity configured on this machine or user

Common

A new laptop, a server account, or git run as a different user (for example under sudo) whose ~/.gitconfig has no user.name or user.email.

Confirm

git config --show-origin --get user.email; git config --show-origin --get user.name

No output: nothing is set for this user or repository

Fix

  • Set it once for your user: git config --global user.name "Your Name" and git config --global user.email you@example.com.
  • Or only for this repository: the same commands without --global.
git config --global user.name "Your Name" && git config --global user.email you@example.com

Use the email your Git host knows, so commits link to your account.

A CI job or container commits

Common

Release jobs, bots and Docker builds that run git commit start with no configuration at all.

Confirm

id -un; git config --global --list 2>&1 | head -3

The user the job runs as, then no user.name or user.email lines; with no global config file at all, git prints fatal: unable to read config file … No such file or directory

Fix

  • Set a bot identity in the job before committing, in the repository being committed to: git config user.name "release-bot" and git config user.email release-bot@example.com. Add --global to cover every repository in the job.
  • Or pass it for one command: git -c user.name=release-bot -c user.email=release-bot@example.com commit -m "…".

Understanding it properly

Skip this if you are mid-incident — the working part of the page is above. Worth reading afterwards, because understanding the mechanism is what stops the next one.

In plain terms

Every Git commit records who made it: a name and an email address. On a new machine, a container or a CI job, nobody has told Git who you are yet. Git tries to guess from the system, and when it cannot, it stops and prints the two commands to run.

Words used on this page

user.name, user.email
The identity Git writes into each commit as author and committer.
--global
Stores the setting in your user's ~/.gitconfig for every repository; without it, only the current repository.
user.useConfigOnly
When true, Git never guesses an identity from the system and always requires the configured one.
What is actually happening

Reproduced on Git 2.50.1 with an empty home directory and user.useConfigOnly set: git commit exited with code 128. It printed "Author identity unknown" and "*** Please tell me who you are.", then the two git config --global commands, and finally "fatal: no email was given and auto-detection is disabled".

Without that setting Git tries to build an address from the user and host name. Where it cannot, it stops; Git's source gives that message as unable to auto-detect email address (got '…'). Where it can, it commits with a guessed address. On the Ubuntu production host, Git 2.43.0 committed silently that way, which is how commits end up authored by root@some-hostname.

Omitting --global sets the identity for the current repository only, which reproduced cleanly as well.

How to tell this is your problem
WhereWhat you see
git commitAuthor identity unknown *** Please tell me who you are. Run git config --global user.email "you@example.com" git config --global user.name "Your Name"
Same output, last linefatal: unable to auto-detect email address (got 'root@HOSTNAME.(none)') or fatal: no email was given and auto-detection is disabled

How to know it is actually fixed

  • git commit succeeds, and git log -1 --format='%an <%ae>' shows the intended identity.

Stopping it happening again

  • Set user.useConfigOnly true on your machine, so Git never commits with a guessed address.
  • Put the bot identity in your CI templates.

Security considerations

  • Commit identity is not authentication: anyone can type any name and email. Use signed commits if the author must be verifiable.
  • In CI, use a clearly labelled bot identity, not a person's address, so automated commits are recognisable.

Sources

Behaviour described here is drawn from official documentation. Where a figure could not be confirmed on an official page it is attributed in the text rather than stated as canonical.

Did this get you to an answer?

No text box on purpose — please do not paste production logs anywhere

Something wrong or out of date? Report it