Table of Contents
Filenames too long in a main repository that you cannot update directly?
So, I ran in this issue when I tried to pull a new branch and tried to merge main into it. I had a list of files where the filename were too long, so I won’t share all of them with you, but here is one example.
I guess this can happen when you do a checkout, pull, sync etc.
error: cannot stat '...example.json': Filename too longLet’s fix error: cannot stat ‘…example.json’: Filename too long
You can open Git Bash, PowerShell, or whatever IDE you’re using, most of the time you can run Git commands.
For a specific repository run:
git config core.longpaths trueAnd run the following if you want to do it for globally:
git config --system core.longpaths trueSince some IDE’s do not look at the –system, you can also change this in Git global scope:
git config --global core.longpaths trueChange it in the Windows Registry Editor
If you’re using Windows 10 or later, you can also enable long path support at the operating system level. Here’s how:
- Open the Registry Editor
PressWin + R, typeregedit, and hit Enter. - Navigate to the LongPathsEnabled Key
Go to: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem - Enable Long Paths
- Find the
LongPathsEnabledentry. - If it doesn’t exist, right-click in the right pane, select New > DWORD (32-bit) Value, and name it
LongPathsEnabled. - Set the value to
1to enable long paths.
- Find the
- Restart Your Computer
After making this change, restart your computer for it to take effect.
Open Registry Editor and go to: Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem
And update LongPathsEnabled to 1.

Git Configuration: Setting core.longpaths to true tells Git to bypass the default Windows path length limitation.
Windows Configuration: Enabling long paths at the OS level ensures that all applications, including Git, can work with longer file paths.

