在 Windows 系统下使用 Git 时,执行 git checkout 操作可能会遇到 "Filename too long" 错误。这通常是由于 Windows 对文件路径长度的限制(默认 260 字符)导致的。本文将系统梳理该问题的解决方案及技术要点。
启用 Git 长路径支持
- 作用范围:全局生效(适用于所有仓库)。
bash
git config --global core.longpaths true
- 作用范围:仅当前仓库生效
bash
git config core.longpaths true