Skip to content
This repository has been archived by the owner. It is now read-only.

Git cannot create a file or directory with a long path

Mike Friedrich edited this page Mar 2, 2017 · 2 revisions

Summary

Problem

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).

Opt-In configuration

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

Technical background

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.

Implementation details

See this issue and the current fix implemented here.

You can’t perform that action at this time.