This error occurs when a Git configuration setting expects a boolean value (true/false) but receives an invalid value instead. Common causes include accidental equals signs, quoted values, or null entries from GUI clients.
When Git encounters a configuration option that expects a boolean value but finds something invalid, it displays "fatal: bad boolean config value '<value>' for '<setting>'". Git boolean settings must use specific values: true, yes, on, 1 for true, or false, no, off, 0 for false. This error commonly occurs in three scenarios: 1. **Accidental equals sign in commands**: Running `git config core.autocrlf = false` passes "=" as the value instead of "false" because Git interprets the space before = as ending the value parameter. 2. **GUI clients setting null values**: Some Git GUI tools (like GitKraken) may set config values to "null" rather than removing settings, which Git cannot interpret as a boolean. 3. **Quoted boolean values**: Having values like `"false"` (with literal quotes in the config file) instead of just `false` causes parsing errors. The config setting can be at any level - system (/etc/gitconfig), global (~/.gitconfig), or local (.git/config) - and any of these files may contain the malformed value.
First, find where the invalid config value is defined. The error message tells you which setting is affected.
Read the error message carefully:
fatal: bad boolean config value '=' for 'core.autocrlf'This tells you:
- The invalid value is '='
- The setting is 'core.autocrlf'
Find where this setting is defined:
# Show the value and its source file
git config --show-origin --get core.autocrlf
# Example output:
# file:/home/user/.gitconfig =List all values (in case of duplicates):
git config --show-origin --get-all core.autocrlfShow the scope (system/global/local):
git config --show-origin --show-scope --get core.autocrlf
# Example output:
# global file:/home/user/.gitconfig =This tells you which file to edit and at what level (system, global, or local).
The safest way to fix the issue is to unset the invalid value and then set it correctly.
For global config (~/.gitconfig):
# Unset the value
git config --global --unset core.autocrlf
# Verify it's removed
git config --global --get core.autocrlf
# Should return nothingFor local repository config (.git/config):
# Unset locally
git config --unset core.autocrlfFor system config (requires admin/root):
# On Linux/macOS
sudo git config --system --unset core.autocrlf
# On Windows (run as Administrator)
git config --system --unset core.autocrlfIf there are multiple values:
# Unset all values for this key
git config --global --unset-all core.autocrlfAfter unsetting, set the value correctly. Git accepts several formats for boolean values.
Valid boolean values:
| True values | False values |
|-------------|--------------|
| true | false |
| yes | no |
| on | off |
| 1 | 0 |
Set the value correctly (no equals sign with spaces!):
# CORRECT - no spaces around the value
git config --global core.autocrlf true
# CORRECT - alternative syntax with equals (no spaces)
git config --global core.autocrlf=trueCommon mistakes to avoid:
# WRONG - equals sign becomes the value
git config --global core.autocrlf = true
# WRONG - quotes might be stored literally in some shells
git config --global core.autocrlf "true"
# WRONG - case matters in some contexts
git config --global core.autocrlf TRUEVerify the setting:
git config --global --get core.autocrlf
# Should output: trueIf git config commands don't work due to the corruption, edit the file directly.
Open the config file in your editor:
# Edit global config
git config --global --edit
# Or open directly
# Linux/macOS
nano ~/.gitconfig
# or
vim ~/.gitconfig
# Windows
notepad %USERPROFILE%\.gitconfigFind and fix the problematic line:
# WRONG - has equals sign as value
[core]
autocrlf = =
# WRONG - has null value
[commit]
gpgsign = null
# WRONG - has quoted value
[http]
sslverify = "false"
# CORRECT
[core]
autocrlf = true
[commit]
gpgsign = true
[http]
sslverify = trueCommon config file locations:
| Level | Linux/macOS | Windows |
|-------|-------------|---------|
| System | /etc/gitconfig | C:\Program Files\Git\etc\gitconfig |
| Global | ~/.gitconfig | C:\Users\<name>\.gitconfig |
| Local | .git/config | .git\config |
GitKraken and some other Git GUI clients are known to write "null" to config settings instead of removing them.
Common affected settings:
# Check for null values in common settings
git config --global --get commit.gpgsign
git config --global --get tag.forcesignannotated
git config --global --get user.signingkeyFix null values:
# If you want the feature disabled, unset it
git config --global --unset commit.gpgsign
# If you want the feature enabled, set it properly
git config --global commit.gpgsign truePrevent future issues with GitKraken:
If you're using GitKraken and experiencing repeated null values:
1. Check if there's an update for GitKraken that fixes this issue
2. Configure settings via command line instead of the GUI
3. After making changes in GitKraken, verify config with:
git config --global --list | grep -i nullIf you have multiple invalid boolean values, you can find and fix them all.
List all config values to inspect:
# Show all configs with their origins
git config --list --show-origin --show-scopeSearch for suspicious values:
# Look for null values
git config --list | grep -i null
# Look for equals signs as values
git config --list | grep "= ="
# Look for quoted values (in config file)
grep -E '= ["']' ~/.gitconfigReset problematic sections entirely:
# Remove entire section and re-add only what you need
git config --global --remove-section core
git config --global core.autocrlf true
git config --global core.editor "code --wait"
# Add other core settings as neededNote: Be careful with --remove-section as it removes ALL settings in that section.
After making changes, verify Git is working correctly.
Test basic commands:
# These should all work without errors
git status
git config --list
git log --oneline -5Verify the specific setting:
# Check the value is correct
git config --show-origin --show-scope core.autocrlf
# Should show something like:
# global file:/home/user/.gitconfig trueTest in your repository:
cd your-repo
git status
git fetchIf commands work without the "bad boolean config value" error, the fix was successful.
Follow these practices to avoid boolean config errors:
Always use correct syntax:
# CORRECT - value directly after the key
git config --global core.autocrlf true
# CORRECT - equals without spaces
git config --global core.autocrlf=false
# WRONG - spaces around equals
git config --global core.autocrlf = trueUse tab completion: Most shells complete git config keys, reducing typos.
Check after GUI changes: After using Git GUIs, verify config:
git config --list --show-origin | head -20Back up your config: Keep a backup of your working ~/.gitconfig:
cp ~/.gitconfig ~/.gitconfig.backupUse git config --type for validation:
Git 2.18+ supports type validation:
# This validates the value is a valid boolean
git config --global --type=bool core.autocrlf true### Understanding Git Config Levels
Git reads configuration from multiple files in order of precedence (later overrides earlier):
1. System (/etc/gitconfig): Applies to all users on the system
2. Global (~/.gitconfig): Applies to all repositories for the current user
3. Local (.git/config): Applies only to the specific repository
4. Worktree (.git/config.worktree): Git 2.20+, per-worktree settings
A bad value at any level can cause the error. Use --show-origin to identify which file.
### Boolean Normalization
Since Git 2.39, Git explicitly describes all boolean values as "true" or "false" in output, even if you set them as "yes", "on", or "1". Internally, Git accepts all these synonyms:
- True: true, yes, on, 1
- False: false, no, off, 0 (empty string also means false for some settings)
### Common Boolean Settings
These settings expect boolean values and commonly trigger this error:
| Setting | Purpose |
|---------|---------|
| core.autocrlf | Line ending conversion |
| core.filemode | Track file permission changes |
| core.ignorecase | Case sensitivity |
| core.longpaths | Windows long path support |
| commit.gpgsign | Sign commits with GPG |
| push.autosetupremote | Auto track remote branches |
| http.sslverify | Verify SSL certificates |
| pull.rebase | Rebase on pull |
### CI/CD Considerations
In CI/CD pipelines, this error might appear from:
1. Environment variable conflicts: GIT_TERMINAL_PROMPT=0 is valid, but GIT_TERMINAL_PROMPT="0 for" is not
2. Docker image configs: Base images may have corrupted gitconfig
3. Shared runners: Previous jobs may have modified global config
Fix in CI:
# GitLab CI example
before_script:
- git config --global --unset-all core.autocrlf || true
- git config --global core.autocrlf false### Windows-Specific Issues
On Windows, Git config files might have:
- BOM (Byte Order Mark): Can corrupt the file
- Wrong line endings: Use LF, not CRLF in gitconfig
- Hidden characters: Copy-paste from web might include invisible characters
To fix BOM issues on Windows:
# PowerShell - resave without BOM
$content = Get-Content ~/.gitconfig -Raw
[System.IO.File]::WriteAllLines("$env:USERPROFILE\.gitconfig", $content)kex_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