How to fix error: cannot run diff driver 'driver-name': No such file or directory in Git
This error occurs when Git tries to use a custom diff driver specified in .gitattributes, but the driver command is not found or not properly configured in your Git config.
Quick fix
Fixes error: cannot run diff driver 'driver-name': No such file or directory
error: cannot run diff driver 'jupyternotebook': No such file or directory- Identify the missing diff driver
- Check your .gitattributes file
- Configure the diff driver in your Git config
- Install the required driver tool
error: cannot run diff driver 'jupyternotebook': No such file or directoryerror: cannot run diff driver 'driver-name': No such file or directory
What this error means
This error indicates that Git found a diff driver reference in your .gitattributes file, but the corresponding driver command is either not configured in your Git config or the executable is not available in your PATH. Git's diff driver system allows you to customize how diffs are generated for specific file types. This requires two-part configuration: first, you define which files use a driver in .gitattributes (e.g., '*.ipynb diff=jupyternotebook'), and second, you configure what command the driver runs in your .git/config or ~/.gitconfig file. The error occurs when there's a mismatch between these two configurations - your .gitattributes references a driver that hasn't been properly set up in your Git configuration.
Typical symptoms
- Git diff, log, or show commands fail with "cannot run diff driver" error
- Error message includes the name of the missing driver
- Commands work after removing or commenting out .gitattributes entries
- Other team members can run diff successfully with the same repository
- Error appears after cloning a repository or pulling .gitattributes changes
Common causes
- Diff driver is defined in .gitattributes but not configured in .git/config or ~/.gitconfig
- Driver command is configured but the executable is not installed or not in PATH
- Typo or mismatch between driver name in .gitattributes and config file
- Cloned a repository with .gitattributes but custom drivers were not set up locally
- Driver command was removed or uninstalled after initial configuration
How to fix "error: cannot run diff driver 'driver-name': No such file or directory"
First, look at the error message to identify which driver is missing:
error: cannot run diff driver 'jupyternotebook': No such file or directoryThe driver name is shown in quotes (in this case, 'jupyternotebook').
View the .gitattributes file to see which files use this driver:
cat .gitattributesYou might see something like:
*.ipynb diff=jupyternotebook
*.csv diff=csv_diffAdd the driver configuration to your Git config. You can do this globally (for all repos) or locally (for just this repo):
For a global configuration:
git config --global diff.jupyternotebook.command 'git-nbdiffdriver diff'For a local configuration:
git config diff.jupyternotebook.command 'git-nbdiffdriver diff'Replace 'jupyternotebook' with your driver name and the command with the appropriate executable.
If the driver command requires a specific tool, make sure it's installed and in your PATH:
For nbdime (Jupyter notebooks):
pip install nbdimeFor other custom diff drivers:
Check the repository documentation or team wiki for installation instructions. Common diff drivers include:
- git-nbdiffdriver (Jupyter notebooks)
- git-diff-drivers collection (various file types)
- Custom scripts specific to your project
Check that your Git config includes the driver:
git config --list | grep diffYou should see something like:
diff.jupyternotebook.command=git-nbdiffdriver diffThen test the diff command:
git diffIf you need to view diffs immediately and can't set up the driver, you can temporarily disable it:
git --no-pager diff --no-ext-diffThe --no-ext-diff flag tells Git to use its default diff behavior and ignore custom drivers.
Or rename .gitattributes temporarily:
mv .gitattributes .gitattributes.bak
git diff
mv .gitattributes.bak .gitattributesAdvanced notes
Security Consideration:
Custom diff drivers are not automatically cloned with repositories for security reasons. This prevents malicious repositories from executing arbitrary code on your system. Team members must explicitly configure drivers locally.
Exit Code Behavior:
By default, Git expects diff drivers to return exit code 0 regardless of whether files differ. You can change this with:
git config diff.drivername.trustExitCode trueWith this setting, the driver should return 0 for equal files and 1 for different files (like standard diff).
Using --ext-diff:
Many Git commands (like git log and git show) only use external diff drivers when you specify the --ext-diff flag explicitly:
git show --ext-diff
git log -p --ext-diffGlobal vs Local Configuration:
Consider whether to set up drivers globally or per-repository. Global setup (~/.gitconfig) is convenient if you work with many repos using the same file types. Local setup (.git/config) is better for project-specific drivers.
Frequently asked questions
- What does "error: cannot run diff driver 'driver-name': No such file or directory" mean?
- gitattributes file, but the corresponding driver command is either not configured in your Git config or the executable is not available in your PATH. Git's diff driver system allows you to customize how diffs are generated for specific file types. gitconfig file.
- How do I fix "error: cannot run diff driver 'driver-name': No such file or directory"?
- This error occurs when Git tries to use a custom diff driver specified in .gitattributes, but the driver command is not found or not properly configured in your Git config.
- What causes "error: cannot run diff driver 'driver-name': No such file or directory"?
- Diff driver is defined in .gitattributes but not configured in .git/config or ~/.gitconfig Driver command is configured but the executable is not installed or not in PATH Typo or mismatch between driver name in .gitattributes and config file
- Is the "error: cannot run diff driver 'driver-name': No such file or directory" error serious?
- It is a medium-severity error โ more of a blocker than a risk. The steps above resolve it.
Official resources & further reading
- ๐Git Official Documentation
- ๐Git Official Documentation(Official Docs)
- ๐ฌStack Overflow: Git git-gitattributes-diff-driver-error(Stack Overflow)
- ๐Git GitHub Issues(GitHub)