【Exception】warning: Clone succeeded, but checkout failed. error: unable to create file xxx

Talk is cheap, show me the code.

环境 | Environment

k version
OS windows 11
jdk 1.8
git git version 2.20.1.windows.1

复现步骤 | Reproduction steps

  1. git clone [email protected]:tanpenggood-fork/shenyu.git

报错日志 | Error log

$ git clone [email protected]:tanpenggood-fork/shenyu.git
Cloning into 'shenyu'...
remote: Enumerating objects: 126080, done.
remote: Counting objects: 100% (10268/10268), done.
remote: Compressing objects: 100% (707/707), done.
remote: Total 126080 (delta 9660), reused 9562 (delta 9561), pack-reused 115812
Receiving objects: 100% (126080/126080), 43.21 MiB | 4.84 MiB/s, done.
Resolving deltas: 100% (42462/42462), done.
error: unable to create file shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-spring-websocket/src/main/java/org/apache/shenyu/springboot/starter/client/spring/websocket/ShenyuSpringWebSocketClientConfiguration.java: Filename too long
error: unable to create file shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-spring-websocket/src/test/java/org/apache/shenyu/springboot/starter/client/spring/websocket/ShenyuSpringWebSocketClientConfigurationTest.java: Filename too long
error: unable to create file shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-springcloud/src/main/java/org/apache/shenyu/springboot/starter/client/springcloud/ShenyuSpringCloudClientInfoRegisterConfiguration.java: Filename too long
fatal: cannot create directory at 'shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-dubbo/shenyu-spring-boot-starter-plugin-alibaba-dubbo/src/main/java/org/apache/shenyu/springboot/starter/plugin/alibaba/dubbo': Filename too long
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'

原因分析 | Analysis

源码中文件路径太长,导致 git创建路径失败。

解决方案 | Solution

  1. 在 clone 的时候添加参数 -c core.longpaths=true
    git clone -c core.longpaths=true [email protected]:tanpenggood-fork/shenyu.git
    

参考 | References

CSDN - Git Clone 的时候遇到 Filename too long 错误

你可能感兴趣的:(Exception,GIT系列,git,shenyu)