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设置方式 点击这里查看.

相关推荐
悟空瞎说17 小时前
Git Worktree 实战:多 AI 编码代理并行开发,彻底解决分支切换冲突痛点
前端·git
BING_Algorithm19 小时前
开发常用Git核心知识
git·后端
Lyyaoo.19 小时前
Git常用命令及应用
git
呆萌很21 小时前
Git 配置 .gitignore 文件
git
小则又沐风a21 小时前
Linux下的Git的上传(版本控制器)
linux·数据库·git
天真吴邪xie1 天前
Claude Code安装
java·git
曾几何时`2 天前
虚拟环境pip
git
她说可以呀2 天前
git的版本回退
git
躺不平的理查德2 天前
Shell逻辑判断备忘录
运维·服务器·git