windows下git clone时出现“Filename too long”错误的解决办法

在windows下,当使用git clone复制项目时,出现下述错误表示项目中有文件民字符过长的问题,需要开启git的长路径支持解决:

bash 复制代码
fatal: cannot create directory at 'xxxx': 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 :/'

方法如下:

  1. 使用管理员模式运行git

  2. 设置系统变量为长路劲有效:

    git config --system core.longpaths true

Note: 如果第二步还是报错,可以设置git全局变量的长路径有效:

复制代码
git config --global core.longpaths true

更多git的 git config设置方式 点击这里查看.

相关推荐
louisgeek17 小时前
Git submodule 子模块
git
imDwAaY17 小时前
6篇文章讲清楚Git:Git 实用技巧:暂存现场、挑选提交与定位 Bug (5/6)
git·后端
imDwAaY17 小时前
6篇文章讲清楚Git:Git 团队开发实践:从 Pull Request 到版本发布 (6/6)
git·后端
誰能久伴不乏1 天前
看懂 Git 团队协作全流程:分支、提交、PR、rebase 到底在干嘛
git
sunshine22 girl1 天前
git tag-项目流程
git
imDwAaY2 天前
6篇文章讲清楚Git:Git 远程协作:fetch、pull、push 到底有什么区别?(3/6)
git·后端
imDwAaY2 天前
6篇文章讲清楚Git:Git 撤销与恢复:reset、revert、restore 应该怎么选?(4/6)
git
用户73309646123092 天前
再也不怕手滑丢代码!给 git 高危操作加一层安全校验
git
广白2 天前
Git Tag 实战:从出包追溯到版本发布
前端·git·面试
Winlifes7 天前
我给 Codex 做了一个 Git 面板:分支树、提交历史和工作区操作
git