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.
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., "[email protected]") When either of these is missing or empty, Git cannot create a valid commit author string (which looks like "John Doe <[email protected]>"). 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
The most common fix is to set your user name in the global Git configuration:
git config --global user.name "Your Name"
git config --global user.email "[email protected]"Verify the configuration was saved:
git config --global user.name
git config --global user.emailThe global config is stored in ~/.gitconfig (or ~/.config/git/config on some systems). This configuration applies to all repositories unless overridden locally.
If you need different identities for different projects (e.g., work vs personal), set the config at the repository level:
# 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 "[email protected]"This creates entries in .git/config within that repository, which take precedence over global settings.
Verify with:
git config user.name
git config user.emailSometimes the local .git/config file has an empty [user] section that overrides your global settings:
# Check local config
cat .git/configIf you see something like:
[user]
name =
email =or just:
[user]Remove or fix this section. You can either:
Option 1: Remove the empty entries
git config --local --unset user.name
git config --local --unset user.emailOption 2: Edit the file directly
Open .git/config and remove the empty [user] section entirely.
Option 3: Set proper values
git config --local user.name "Your Name"
git config --local user.email "[email protected]"Environment variables can override Git config settings. If they're set to empty strings, you'll get this error:
# 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:
unset GIT_AUTHOR_NAME
unset GIT_AUTHOR_EMAIL
unset GIT_COMMITTER_NAME
unset GIT_COMMITTER_EMAILFor a permanent fix, check your shell configuration files (~/.bashrc, ~/.zshrc, ~/.profile) for any lines that set these variables to empty values.
If you're getting this error when running git commit --amend, even after setting your user name, you need to reset the author:
# First, ensure your config is correct
git config user.name "Your Name"
git config user.email "[email protected]"
# Then amend with --reset-author to update the commit's author info
git commit --amend --reset-authorWithout --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:
git commit --amend --reset-author --no-editIn automated environments, you need to configure Git identity before making commits:
Dockerfile:
RUN git config --global user.name "CI Bot" && \
git config --global user.email "[email protected]"GitHub Actions:
- 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:
before_script:
- git config --global user.name "GitLab CI"
- git config --global user.email "[email protected]"Jenkins:
sh 'git config user.name "Jenkins"'
sh 'git config user.email "[email protected]"'To understand where your Git configuration is coming from, use:
# 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.emailThis will show output like:
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:
# System-wide config
git config --system --list
# Global (user) config
git config --global --list
# Local (repository) config
git config --local --listGit 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:
# 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:
[user]
name = Personal Name
email = [email protected]
[includeIf "gitdir:~/work/"]
path = ~/.gitconfig-workThen in ~/.gitconfig-work:
[user]
name = Work Name
email = [email protected]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:
# 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:
git log --format="%an <%ae>" -1To see both author and committer:
git log --format="Author: %an <%ae>%nCommitter: %cn <%ce>" -1kex_exchange_identification: Connection closed by remote host
Connection closed by remote host when connecting to Git server
fatal: unable to access: Proxy auto-configuration failed
How to fix 'Proxy auto-configuration failed' in Git
fatal: unable to access: Authentication failed (proxy requires basic auth)
How to fix 'Authentication failed (proxy requires basic auth)' in Git
fatal: unable to access: no_proxy configuration not working
How to fix 'no_proxy configuration not working' in Git
fatal: unable to read tree object in treeless clone
How to fix 'unable to read tree object in treeless clone' in Git