Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

git clone时遇到了一个windows10下文件名太长的报错 #29

Open
peteryuanpan opened this issue Jul 28, 2020 · 3 comments
Open
Labels
question Further information is requested

Comments

@peteryuanpan
Copy link

peteryuanpan commented Jul 28, 2020

报错如下

C:\Users\Admin\Desktop\plan\2020>git clone [email protected]:YunaiV/SpringBoot-Labs.git
Cloning into 'SpringBoot-Labs'...
remote: Enumerating objects: 551, done.
remote: Counting objects: 100% (551/551), done.
remote: Compressing objects: 100% (352/352), done.
remote: Total 18050 (delta 269), reused 441 (delta 168), pack-reused 17499R
Receiving objects: 100% (18050/18050), 1.66 MiB | 262.00 KiB/s, done.
Resolving deltas: 100% (5126/5126), done.
error: unable to create file lab-68-spring-security-oauth/lab-68-demo02-authorization-server-with-resource-owner-password-credentials/src/main/java/cn/iocoder/springboot/lab68/authorizationserverdemo/config/OAuth2AuthorizationServerConfig.java: Filename too long
error: unable to create file lab-68-spring-security-oauth/lab-68-demo03-authorization-server-with-resource-owner-password-credentials/src/main/java/cn/iocoder/springboot/lab68/authorizationserverdemo/config/OAuth2AuthorizationServerConfig.java: Filename too long

Updating files: 100% (3373/3373), 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 with 'git restore --source=HEAD :/

网上搜了下,win10下默认文件名长度最长为256

测下文件名长度,已经超过了256

python
>>> a = "C:\Users\Admin\Desktop\plan\2020\SpringBoot-Labs\lab-68-spring-security-oauth\lab-68-demo02-authorization-server-with-resource-owner-password-credentials\src\main\java\cn\iocoder\springboot\lab68\authorizationserverdemo\config\OAuth2AuthorizationServerConfig.java"
>>> print(len(a))
259

解决办法:

  • 在D盘下进行git clone,没有此问题,参考 https://www.zhihu.com/question/29472905 中 叛逆者 的回复
  • 解除wins10下长度限制,网上有方案,但没有尝试
  • 芋芋考虑缩短下文件名路径长度?
@YunaiV
Copy link
Collaborator

YunaiV commented Jul 28, 2020

使用 D 盘可以解决么?

我其实还想把名字加上,保证大家一看目录就知道是啥。

如果 D 盘可以,我就写到提示里,哈哈哈。

@YunaiV YunaiV added the question Further information is requested label Jul 28, 2020
@dswt001
Copy link

dswt001 commented Jul 30, 2020

确实有这个问题,提示的都一样,不过太晚了就不试了,改天试试看。

@joker452
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants