解决 Git Filename too long 错误

Git 在 Windows 下 Checkout 项目时报 “Filename too long” 错误的解决方法。
由于项目是 pom.xml 中嵌套 pom.xml,导致某些类的文件路径特别长。因此在 Windows 10 下面,使用 IDEA 去 CheckOut 项目时抛出了 “Filename too long” 错误。详细错误信息如下:
1 | error: unable to create file *.java: Filename too long |
解决方法
1) git config 命令方式
打开 dos 命令行窗口,执行下面 git 命令:
1 | git config --global core.longpaths true |
开启 git 全局支持长路径。
2) 修改项目 config 配置文件
打开你的项目,找到 .git 隐藏目录,找到 config 配置文件,使用文本编辑器打开,在 [core] 配置项后面添加如下配置:
1 | [core] |