I was trying to clone my open source project on Windows 10, but got the following error:
fatal: cannot create directory at 'node_modules/bower/node_modules/update-notifier/node_modules/latest-version/node_modules/package-json/node_modules/got/node_modules/duplexify/node_modules/end-of-stream/node_modules/once/node_modules /wrappy': Filename too long
warning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status'
and retry with 'git restore --source=HEAD :/'
The folder where I am trying to clone is:
C:\Users\MiNombreDeUsuarioQueNoTieneEspacios\IdeaProjects
Is there a way to enable long paths?
Based on this answer from iveqy I proceeded as follows:
1.- I searched my Windows for the git installation path:
Where a file called gitconfig is located , which has a structure like the following:
The part that we are interested in modifying at the core level is called longpaths , by default it is found
false
here, we can change it manually and save the changes or we can guide ourselves as indicated in the response through the following command:It happens due to a general limitation of Windows that recognizes, by default, the length of paths up to 260 characters. One way to get git to recognize long paths is (As admin):
If it's just to clone the repository, without affecting the general git configuration
For Windows 10 to recognize long paths permanently, from the registry editor (regedit)
Filename too long in Git for Windows
How to fix “Filename too long error” during git clone