How to fix fatal: empty ident name (for <email>) not allowed in Git

GitBEGINNERMEDIUMUpdated Dec 6, 2025ยท 229 views

This error occurs when Git cannot determine your identity (name) for commits. Git requires both a user name and email to be configured before you can create commits. The fix involves setting your Git user.name configuration, either globally or for the specific repository.

Quick fix

Fixes fatal: empty ident name (for <email>) not allowed

git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"
  1. Set your Git user name globally
  2. Set user name for a specific repository
  3. Remove empty [user] section from local config
  4. Check and unset conflicting environment variables
git โ€” error
git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"
fatal: empty ident name (for <email>) not allowed

What this error means

The "fatal: empty ident name (for <email>) not allowed" error means Git is trying to create a commit or perform an operation that requires author identification, but your user name is either not set or set to an empty string. Git requires two pieces of identity information to create commits: 1. **user.name** - Your name (e.g., "John Doe") 2. **user.email** - Your email address (e.g., "john@example.com") When either of these is missing or empty, Git cannot create a valid commit author string (which looks like "John Doe <john@example.com>"). The error message includes "(for <email>)" to show that while an email might be detected, the name portion is empty. This commonly happens in these scenarios: - Fresh Git installation where user configuration was never set up - CI/CD pipelines or Docker containers without proper Git configuration - Local repository config has an empty [user] section overriding global settings - Environment variables (GIT_AUTHOR_NAME, GIT_COMMITTER_NAME) are set to empty strings

Typical symptoms

  • Git commit fails with 'fatal: empty ident name (for <email>) not allowed'
  • Git commit --amend fails even though the original commit worked
  • Git rebase --continue throws the empty ident error
  • CI/CD pipeline fails during git commit step
  • Git operations work with sudo but fail as regular user
  • Error appears in Docker containers or fresh development environments
  • git am or git cherry-pick operations fail with identity error

Common causes

  1. user.name is not configured in Git config (most common)
  2. Local .git/config has an empty [user] section overriding global config
  3. Environment variables GIT_AUTHOR_NAME or GIT_COMMITTER_NAME are set to empty strings
  4. Running Git as a different user (e.g., through sudo) with no config for that user
  5. Docker container or CI environment without Git identity setup
  6. Amending a commit that was created when user.name was set, but now it's empty
  7. Corrupted or malformed .gitconfig file

How to fix "fatal: empty ident name (for <email>) not allowed"

1Set your Git user name globally

The most common fix is to set your user name in the global Git configuration:

bash
git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"

Verify the configuration was saved:

bash
git config --global user.name
git config --global user.email

The global config is stored in ~/.gitconfig (or ~/.config/git/config on some systems). This configuration applies to all repositories unless overridden locally.

2Set user name for a specific repository

If you need different identities for different projects (e.g., work vs personal), set the config at the repository level:

bash
# Navigate to your repository
cd /path/to/your/repo

# Set local user config (without --global)
git config user.name "Your Name"
git config user.email "your.email@example.com"

This creates entries in .git/config within that repository, which take precedence over global settings.

Verify with:

bash
git config user.name
git config user.email
3Remove empty [user] section from local config

Sometimes the local .git/config file has an empty [user] section that overrides your global settings:

bash
# Check local config
cat .git/config

If you see something like:

ini
[user]
    name =
    email =

or just:

ini
[user]

Remove or fix this section. You can either:

Option 1: Remove the empty entries

bash
git config --local --unset user.name
git config --local --unset user.email

Option 2: Edit the file directly
Open .git/config and remove the empty [user] section entirely.

Option 3: Set proper values

bash
git config --local user.name "Your Name"
git config --local user.email "your.email@example.com"
4Check and unset conflicting environment variables

Environment variables can override Git config settings. If they're set to empty strings, you'll get this error:

bash
# Check for Git-related environment variables
env | grep GIT_

# Look specifically for these:
echo "GIT_AUTHOR_NAME: $GIT_AUTHOR_NAME"
echo "GIT_AUTHOR_EMAIL: $GIT_AUTHOR_EMAIL"
echo "GIT_COMMITTER_NAME: $GIT_COMMITTER_NAME"
echo "GIT_COMMITTER_EMAIL: $GIT_COMMITTER_EMAIL"

If any of these are set to empty strings, unset them:

bash
unset GIT_AUTHOR_NAME
unset GIT_AUTHOR_EMAIL
unset GIT_COMMITTER_NAME
unset GIT_COMMITTER_EMAIL

For a permanent fix, check your shell configuration files (~/.bashrc, ~/.zshrc, ~/.profile) for any lines that set these variables to empty values.

5Use --reset-author when amending commits

If you're getting this error when running git commit --amend, even after setting your user name, you need to reset the author:

bash
# First, ensure your config is correct
git config user.name "Your Name"
git config user.email "your.email@example.com"

# Then amend with --reset-author to update the commit's author info
git commit --amend --reset-author

Without --reset-author, Git tries to keep the original commit's author information. If that original author had an empty name, you'll still get the error.

You can also reset the author without changing the commit message:

bash
git commit --amend --reset-author --no-edit
6Fix Git identity in Docker or CI/CD environments

In automated environments, you need to configure Git identity before making commits:

Dockerfile:

dockerfile
RUN git config --global user.name "CI Bot" && \
    git config --global user.email "ci@example.com"

GitHub Actions:

yaml
- name: Configure Git
  run: |
    git config --global user.name "github-actions[bot]"
    git config --global user.email "github-actions[bot]@users.noreply.github.com"

GitLab CI:

yaml
before_script:
  - git config --global user.name "GitLab CI"
  - git config --global user.email "gitlab-ci@example.com"

Jenkins:

groovy
sh 'git config user.name "Jenkins"'
sh 'git config user.email "jenkins@example.com"'
7View all Git config sources to debug conflicts

To understand where your Git configuration is coming from, use:

bash
# Show all config with their sources
git config --list --show-origin

# Show where a specific value comes from
git config --show-origin user.name
git config --show-origin user.email

This will show output like:

bash
file:/home/user/.gitconfig    user.name=Your Name
file:.git/config              user.name=

The last matching entry wins. If you see an empty value from .git/config appearing after your global config, that's the problem.

You can also check each level separately:

bash
# System-wide config
git config --system --list

# Global (user) config
git config --global --list

# Local (repository) config
git config --local --list

Advanced notes

Git Identity Precedence:

Git configuration follows a hierarchy (later sources override earlier ones):
1. System config: /etc/gitconfig (applies to all users)
2. Global config: ~/.gitconfig or ~/.config/git/config (user-specific)
3. Local config: .git/config (repository-specific)
4. Environment variables: GIT_AUTHOR_NAME, GIT_COMMITTER_NAME, etc.

Environment variables have the highest precedence, which is why an empty GIT_AUTHOR_NAME can break things even with a properly configured ~/.gitconfig.

Author vs Committer:

Git distinguishes between:
- Author: The person who wrote the code (user.name, user.email, or GIT_AUTHOR_*)
- Committer: The person who created the commit (user.name, user.email, or GIT_COMMITTER_*)

Usually these are the same person, but they can differ (e.g., when applying patches). Both need valid names.

Windows-Specific Issues:

On Windows, if you're using Git through WSL (Windows Subsystem for Linux), the Windows Git config and Linux Git config are separate. You need to configure both if you use both:

bash
# In WSL
git config --global user.name "Your Name"

# In Windows PowerShell/CMD
git config --global user.name "Your Name"

Multiple Git Identities with Conditional Includes:

If you work on projects requiring different identities, use conditional includes in ~/.gitconfig:

ini
[user]
    name = Personal Name
    email = personal@example.com

[includeIf "gitdir:~/work/"]
    path = ~/.gitconfig-work

Then in ~/.gitconfig-work:

ini
[user]
    name = Work Name
    email = work@company.com

git am and Patch Application:

When using git am to apply patches, if the patch file doesn't contain valid author information, Git will try to use your configured identity. If that's empty, you'll get this error.

For plain diff files without author info, use git apply instead:

bash
# git apply just applies the diff, doesn't create a commit
git apply patch.diff

# Then commit manually
git commit -m "Applied patch"

Checking a Commit's Author Information:

To see the author of existing commits:

bash
git log --format="%an <%ae>" -1

To see both author and committer:

bash
git log --format="Author: %an <%ae>%nCommitter: %cn <%ce>" -1

Frequently asked questions

What does "fatal: empty ident name (for <email>) not allowed" mean?
The "fatal: empty ident name (for <email>) not allowed" error means Git is trying to create a commit or perform an operation that requires author identification, but your user name is either not set or set to an empty string. Git requires two pieces of identity information to create commits: 1. , "John Doe") 2.
How do I fix "fatal: empty ident name (for <email>) not allowed"?
This error occurs when Git cannot determine your identity (name) for commits. Git requires both a user name and email to be configured before you can create commits. The fix involves setting your Git user.name configuration, either globally or for the specific repository.
What causes "fatal: empty ident name (for <email>) not allowed"?
user.name is not configured in Git config (most common) Local .git/config has an empty [user] section overriding global config Environment variables GIT_AUTHOR_NAME or GIT_COMMITTER_NAME are set to empty strings
Is the "fatal: empty ident name (for <email>) not allowed" error serious?
It is a medium-severity error โ€” more of a blocker than a risk. The steps above resolve it.

Official resources & further reading