Azure-Samples/azure-spring-boot-samples

File paths too long when cloning repo - please rename paths

jimbethancourt opened this issue · 4 comments

Please provide us with the following information:

This issue is for a: (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

Clone the repo on Windows from PowerShell. I cloned in C:\code

Any log messages given by the failure

Cloning into 'azure-spring-boot-samples'...
remote: Enumerating objects: 13066, done.
remote: Counting objects: 100% (2913/2913), done.
remote: Compressing objects: 100% (745/745), done.
remote: Total 13066 (delta 2468), reused 2250 (delta 2110), pack-reused 10153
Receiving objects: 100% (13066/13066), 12.11 MiB | 4.94 MiB/s, done.
Resolving deltas: 100% (5033/5033), done.
error: unable to create file aad/spring-security/reactive/webflux/oauth2/spring-cloud-gateway/resource-server-2/src/main/java/com/azure/spring/sample/activedirectory/reactive/webflux/oauth2/gateway/resourceserver2/configuration/ApplicationConfiguration.java: Filename too long
error: unable to create file aad/spring-security/servlet/oauth2/client-access-multiple-resource-server/resource-server-1/src/main/java/com/azure/spring/sample/active/directory/oauth2/servlet/sample03/resource/server1/configuration/ApplicationConfiguration.java: Filename too long
error: unable to create file aad/spring-security/servlet/oauth2/client-access-multiple-resource-server/resource-server-1/src/main/java/com/azure/spring/sample/active/directory/oauth2/servlet/sample03/resource/server1/configuration/WebSecurityConfiguration.java: Filename too long
error: unable to create file aad/spring-security/servlet/oauth2/client-access-multiple-resource-server/resource-server-2/src/main/java/com/azure/spring/sample/active/directory/oauth2/servlet/sample03/resource/server2/configuration/ApplicationConfiguration.java: Filename too long
error: unable to create file aad/spring-security/servlet/oauth2/client-access-multiple-resource-server/resource-server-2/src/main/java/com/azure/spring/sample/active/directory/oauth2/servlet/sample03/resource/server2/configuration/WebSecurityConfiguration.java: Filename too long
error: unable to create file aad/spring-security/servlet/oauth2/login-authenticate-using-private-key-jwt/src/main/java/com/azure/spring/sample/reactive/servlet/oauth2/login/jwt/azure/activedirectory/AzureActiveDirectoryCertificateSignedJwtAssertionFactory.java: Filename too long
error: unable to create file aad/spring-security/servlet/oauth2/login-authenticate-using-private-key-jwt/src/main/java/com/azure/spring/sample/reactive/servlet/oauth2/login/jwt/azure/activedirectory/AzureActiveDirectoryJwtClientAuthenticationParametersConverter.java: Filename too long
error: unable to create file aad/spring-security/servlet/oauth2/login-authenticate-using-private-key-jwt/src/test/java/com/azure/spring/sample/reactive/servlet/oauth2/login/jwt/azure/activedirectory/AzureActiveDirectoryCertificateSignedAssertionFactoryTest.java: Filename too long
error: unable to create file aad/spring-security/servlet/oauth2/resource-server-check-permissions-by-claims-in-access-token/client/src/main/java/com/azure/spring/sample/active/directory/oauth2/servlet/sample02/client/configuration/ApplicationConfiguration.java: Filename too long
error: unable to create file aad/spring-security/servlet/oauth2/resource-server-check-permissions-by-claims-in-access-token/client/src/main/java/com/azure/spring/sample/active/directory/oauth2/servlet/sample02/client/configuration/WebSecurityConfiguration.java: Filename too long
error: unable to create file aad/spring-security/servlet/oauth2/resource-server-check-permissions-by-claims-in-access-token/client/src/main/java/com/azure/spring/sample/active/directory/oauth2/servlet/sample02/client/controller/CheckPermissionByScopeController.java: Filename too long
error: unable to create file aad/spring-security/servlet/oauth2/resource-server-check-permissions-by-claims-in-access-token/client/src/main/java/com/azure/spring/sample/active/directory/oauth2/servlet/sample02/client/controller/ResourceServerController.java: Filename too long
error: unable to create file aad/spring-security/servlet/oauth2/resource-server-check-permissions-by-claims-in-access-token/resource-server/src/main/java/com/azure/spring/sample/active/directory/oauth2/servlet/sample02/resource/server/ResourceServerApplication.java: Filename too long
fatal: cannot create directory at 'aad/spring-security/servlet/oauth2/resource-server-check-permissions-by-claims-in-access-token/resource-server/src/main/java/com/azure/spring/sample/active/directory/oauth2/servlet/sample02/resource/server/configuration': 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 :/'

Expected/desired behavior

no issues should appear when cloning the repo

OS and Version?

Windows 7, 8 or 10. Linux (which distribution). macOS (Yosemite? El Capitan? Sierra?)

Versions

Mention any other details that might be useful


Thanks! We'll be in touch soon.

Hi @jimbethancourt,
Thank you for reaching out to us in GitHub; @chenrujun will follow up shortly.

Hi, @jimbethancourt
Please try this:

git config --system core.longpaths true
git clone Azure-Samples/azure-spring-boot-samples

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

FYI:
I tried to find a way to let customer clone the repo without this command: git config --system core.longpaths true. But failed. Here are more details: git config --system core.longpaths true will add a new configuratoin item in .gitconfig file. But it is not possible to automatically include the custom configuration file through git alone, because it creates a security vulnerability.

Refs: https://stackoverflow.com/questions/18329621/how-to-store-a-git-config-as-part-of-the-repository

Closing this issue.

  1. Workaround has provided to customer.
  2. There is no way to resolve this problem by add configuration files like .gitconfig.
  3. Now we don't have plan to shorten the file path for all sample files.