-
Notifications
You must be signed in to change notification settings - Fork 588
Git cannot create a file or directory with a long path
Windows does not properly support files and directories longer than 260 characters. This applies to Windows Explorer, cmd.exe and many other applications (including many IDEs as well as bash, perl and tcl that come with Git for Windows).
For this reason, long paths support in Git for Windows is disabled by default.
That being said, long paths support for C-based git commands can be enabled by setting the core.longpaths option to true. Scripted git commands may still fail with this option, so use at your own risk.
Example: git config core.longpaths true
The root cause of the technical limitation of 260 chars lies deeply within the Windows API. Microsoft's online article Naming Files, Paths, and Namespaces describes the reasons. Because Git was originally written on Linux, there's no such limitation. Thus the problem occurs when the original Git code is compiled on the Windows platform.
Quote from above link (Naming Files, Paths, and Namespaces):
The Windows API has many functions that also have Unicode versions to permit an extended-length path for a maximum total path length of 32,767 characters.
See this issue and the current fix implemented here.