git 拉取文件时报错

1
Filename too long

stack overflow上的回复

Git has a limit of 4096 characters for a filename, except on Windows when Git is compiled with msys. It uses an older version of the Windows API and there’s a limit of 260 characters for a filename.

git 自身对文件名称的限制是4096个字符(计算机的内存页一般是4kb,很多文件名有这个限制),但是git在windows是有msys编译,比较特殊。使用的是旧版本的windows API,限制是260个字符。

解决方案是:

1
2
git config --system core.longpaths true
git config "--global" core.longpaths true

详细原因请参见原贴:

https://stackoverflow.com/questions/22575662/filename-too-long-in-git-for-windows