Spring-boot: Can't checkout project on Windows due to very long file name

Created on 1 Nov 2017  ·  11Comments  ·  Source: spring-projects/spring-boot

Spring Boot project can't be checked out on Windows due to very long file names. git pull and every other operation fails with following error -

error: cannot stat 'spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/plugin/JavaPluginActionIntegrationTests-additionalMetadataLocationsCompilerArgumentIsNotAddedWhenAnnotationProcessorIsNotOnTheClasspath.gradle': Filename too long
task

Most helpful comment

@philwebb Further analysis revealed that registry change alone doesn't resolve the issue. Git also needs to be configured to support long file names. Setting git config --system core.longpaths true seems to work for me.

This stackoverflow thread discuss this very issue from git perspective.

https://stackoverflow.com/questions/22575662/filename-too-long-in-git-for-windows

All 11 comments

What version of Windows are you running? Have you tried checking out the project to somewhere higher up on your drive?

If you're on Windows 10 you could also try this: https://www.howtogeek.com/266621/how-to-make-windows-10-accept-file-paths-over-260-characters/

I am running Windows 10 and I am at D: with long paths already enabled. IMO the problem is with file name length and not the total path length. If it helps, the file name is 134 characters long -

JavaPluginActionIntegrationTests-additionalMetadataLocationsCompilerArgumentIsNotAddedWhenAnnotationProcessorIsNotOnTheClasspath.gradle

Please try to be constructive. Describing something as a “monstrosity” is not.

@wilkinsona I apologies if it was perceived in a wrong way and I assure you it wasn't my intention. I have great respect for the whole team and I just wanted to state that the file name was 'too long'.

Nonetheless, I have corrected the language. Sorry for the inconvenience.

@philwebb Further analysis revealed that registry change alone doesn't resolve the issue. Git also needs to be configured to support long file names. Setting git config --system core.longpaths true seems to work for me.

This stackoverflow thread discuss this very issue from git perspective.

https://stackoverflow.com/questions/22575662/filename-too-long-in-git-for-windows

@kedar-joshi Thank you. Does it work on Windows without the registry change but with the long paths config option enabled?

@wilkinsona Interestingly yes. Windows registry setting plays no role in this context. Enabling long paths in git alone works.

I think this is fixed by https://github.com/spring-projects/spring-boot/commit/9bbccb093a8f0d3840266519605f5abcf468fe76. I can now clone master on Windows 7 without enabling long paths.

Yup, I can confirm that it works on Windows 10 without long paths. Thank you for the quick turnaround.

Hope this solution work otherwise you can also try long path tool it solved most of my long path problems in windows.

set git global setting
git config --system core.longpaths true
or set local setting
git config core.longpaths true

check the setting value
git config core.longpaths

hope that helps

Was this page helpful?
0 / 5 - 0 ratings