Git fails to launch the text editor needed for commits, rebases, or other interactive operations. This happens when the configured editor is missing, incorrectly specified, or not in your system PATH.
This error occurs when Git attempts to open a text editor for user input (such as writing a commit message, performing an interactive rebase, or editing a configuration) but cannot find or execute the configured editor. Git determines which editor to use by checking multiple sources in order: the GIT_EDITOR environment variable, the core.editor configuration setting, the VISUAL environment variable, the EDITOR environment variable, and finally system defaults like vi or vim. If the configured editor doesn't exist at the specified path, isn't installed, or lacks execute permissions, Git will fail with this error. This is particularly common after fresh Git installations, when switching between operating systems or development environments (like containers or WSL), or when an editor has been uninstalled or moved without updating the Git configuration.
First, identify what editor Git is trying to use and where the configuration comes from:
# Check current editor setting
git config core.editor
# See all editor-related settings and their sources
git config --list --show-origin | grep editor
# Check environment variables (Linux/Mac)
echo $GIT_EDITOR
echo $VISUAL
echo $EDITOR
# Check environment variables (Windows)
echo %GIT_EDITOR%
echo %VISUAL%
echo %EDITOR%This will reveal which editor Git is configured to use and whether an environment variable is overriding your configuration.
Check if the configured editor is actually installed and accessible:
# Linux/Mac: Check if editor is in PATH
which vim
which nano
which code
# Or try running it directly
vim --version
code --version
# Windows: Check if editor exists
where notepad++.exe
where code.exeIf the editor doesn't exist or returns "not found", you'll need to either install it or configure a different editor.
Set Git to use an editor that's installed on your system. Choose one that matches your environment:
For terminal editors (recommended for beginners):
# Nano (simplest, user-friendly)
git config --global core.editor "nano"
# Vim (powerful, steeper learning curve)
git config --global core.editor "vim"
# Emacs
git config --global core.editor "emacs -nw"For GUI editors:
# VS Code (must include --wait flag)
git config --global core.editor "code --wait"
# Sublime Text
git config --global core.editor "subl -n -w"
# Notepad++ (Windows - use forward slashes)
git config --global core.editor "'C:/Program Files/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin"
# Atom
git config --global core.editor "atom --wait"The --wait flag is critical for GUI editors - it tells the editor to block until you close the file, otherwise Git will think you're done immediately.
If an environment variable is overriding your core.editor setting with an invalid value, remove it:
Linux/Mac (add to ~/.bashrc, ~/.zshrc, or equivalent):
# Remove the variable
unset GIT_EDITOR
# Or set it to your preferred editor
export GIT_EDITOR="nano"Windows (System Properties → Environment Variables):
- Delete the GIT_EDITOR variable if it exists
- Or update it to point to a valid editor
Remember that GIT_EDITOR takes precedence over core.editor, so if it's set incorrectly, your git config changes won't take effect.
Verify your editor configuration works correctly:
# Test with a commit (will open editor for message)
git commit --allow-empty
# Or test by editing config directly
git config --global --editThe editor should open. Write a test message, save, and close. If it works, the configuration is correct.
Editor Priority Order: Git checks sources in this exact order: GIT_EDITOR environment variable → core.editor config → VISUAL environment variable → EDITOR environment variable → system defaults. Understanding this hierarchy is crucial for debugging configuration issues.
Container and WSL Considerations: When using Docker containers or Windows Subsystem for Linux, editor paths from the host system won't work inside the container/WSL environment. Always configure editors that exist within the same environment where Git is running. For VS Code with WSL, use the 'code' command installed by the "WSL" extension, not the Windows executable path.
Repository-Specific Editors: You can set different editors for specific repositories using local configuration: git config core.editor "nano" (without --global flag). This is useful when working on projects with different editor requirements or in environments with restricted editor access.
Sequence Editor vs Core Editor: Git has a separate core.sequenceEditor setting specifically for interactive rebases. If interactive rebase fails but commits work fine, check this setting separately: git config --global core.sequenceEditor "nano"
GUI Editor Troubleshooting: If a GUI editor opens but Git immediately aborts the operation, you're missing the wait flag. Without it, Git thinks you've finished editing as soon as the window opens. Always include --wait, -w, or equivalent flags for GUI editors.
Fallback to System Defaults: If all else fails and you just need to get work done, you can unset the editor configuration entirely and Git will fall back to system defaults: git config --global --unset core.editor. On most Linux systems this will use vi or vim.
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