Skip to content

Document git option core.longPaths=true to clone the repository on Windows #12069

@imgx64

Description

@imgx64

I'm trying to clone the Spring boot repository on Windows, and I'm getting "Filename too long" errors. I tried with cmd and bash, with the same results:

cmd

C:\Users\myusername\Desktop>git clone https://github.com/spring-projects/spring-boot.git
Cloning into 'spring-boot'...
remote: Counting objects: 339275, done.
remote: Compressing objects: 100% (348/348), done.
remote: Total 339275 (delta 204), reused 571 (delta 176), pack-reused 338586
Receiving objects: 100% (339275/339275), 71.09 MiB | 1.13 MiB/s, done.
Resolving deltas: 100% (140226/140226), done.
error: unable to create file spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/plugin/DependencyManagementPluginActionIntegrationTests-helpfulErrorWhenVersionlessDependencyFailsToResolve.gradle: Filename too long
error: unable to create file spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/plugin/JavaPluginActionIntegrationTests-additionalMetadataLocationsConfiguredWhenProcessorIsPresent.gradle: Filename too long
error: unable to create file spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/plugin/JavaPluginActionIntegrationTests-additionalMetadataLocationsNotConfiguredWhenProcessorIsAbsent.gradle: Filename too long
Checking out files: 100% (5340/5340), done.
fatal: unable to checkout working tree
warning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status'
and retry the checkout with 'git checkout -f HEAD'

bash

 MINGW64 /c/Users/myusername/Desktop
$ git clone https://github.com/spring-projects/spring-boot.git
Cloning into 'spring-boot'...
remote: Counting objects: 339275, done.
remote: Compressing objects: 100% (348/348), done.
remote: Total 339275 (delta 204), reused 571 (delta 176), pack-reused 338586
Receiving objects: 100% (339275/339275), 71.09 MiB | 1.28 MiB/s, done.
Resolving deltas: 100% (140226/140226), done.
error: unable to create file spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/plugin/DependencyManagementPluginActionIntegrationTests-helpfulErrorWhenVersionlessDependencyFailsToResolve.gradle: Filename too long
error: unable to create file spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/plugin/JavaPluginActionIntegrationTests-additionalMetadataLocationsConfiguredWhenProcessorIsPresent.gradle: Filename too long
error: unable to create file spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/plugin/JavaPluginActionIntegrationTests-additionalMetadataLocationsNotConfiguredWhenProcessorIsAbsent.gradle: Filename too long
Checking out files: 100% (5340/5340), done.
fatal: unable to checkout working tree
warning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status'
and retry the checkout with 'git checkout -f HEAD'

Finally, I tried with wsl Ubuntu. The checkout succeeded, but then I got the same error when I tried to interact with the repo from outside wsl:

wsl

/mnt/c/Users/myusername/Desktop$ git clone https://github.com/spring-projects/spring-boot.git
Cloning into 'spring-boot'...
remote: Counting objects: 339275, done.
remote: Compressing objects: 100% (348/348), done.
remote: Total 339275 (delta 204), reused 571 (delta 176), pack-reused 338586
Receiving objects: 100% (339275/339275), 71.09 MiB | 1.27 MiB/s, done.
Resolving deltas: 100% (140226/140226), done.
Checking connectivity... done.
Checking out files: 100% (5340/5340), done.

cmd

C:\Users\myusername\Desktop\spring-boot>git status
On branch master
Your branch is up to date with 'origin/master'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/plugin/DependencyManagementPluginActionIntegrationTests-helpfulErrorWhenVersionlessDependencyFailsToResolve.gradle
        modified:   spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/plugin/JavaPluginActionIntegrationTests-additionalMetadataLocationsConfiguredWhenProcessorIsPresent.gradle
        modified:   spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/plugin/JavaPluginActionIntegrationTests-additionalMetadataLocationsNotConfiguredWhenProcessorIsAbsent.gradle

no changes added to commit (use "git add" and/or "git commit -a")

C:\Users\myusername\Desktop\spring-boot>git checkout -- .
error: unable to create file spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/plugin/DependencyManagementPluginActionIntegrationTests-helpfulErrorWhenVersionlessDependencyFailsToResolve.gradle: Filename too long
error: unable to create file spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/plugin/JavaPluginActionIntegrationTests-additionalMetadataLocationsConfiguredWhenProcessorIsPresent.gradle: Filename too long
error: unable to create file spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/plugin/JavaPluginActionIntegrationTests-additionalMetadataLocationsNotConfiguredWhenProcessorIsAbsent.gradle: Filename too long

Git for Windows version: git version 2.16.1.windows.4
Windows version: Version 1709 (OS Build 16299.248)


After I wrote this issue and before I clicked submit, I found that there's a workaround for long filenames:

git clone -c core.longPaths=true https://github.com/spring-projects/spring-boot.git

So now the question is: should these filenames be shortened to make life easier for Windows users? Or should a note be added to CONTRIBUTING.adoc?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions