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

Talk is cheap, show me the code.

环境 | Environment

kversion
OSwindows 11
jdk1.8
gitgit version 2.20.1.windows.1

复现步骤 | Reproduction steps

  1. git clone git@github.com:tanpenggood-fork/shenyu.git

报错日志 | Error log

$ git clone git@github.com: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 git@github.com:tanpenggood-fork/shenyu.git
    

参考 | References

优快云 - Git Clone 的时候遇到 Filename too long 错误

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值