Recently we have moved our code base from SVN to Git.
But in git, we are facing an issue regarding 'file name too long'.
I would like to know: What is the maximum characters of a file name including the path supported by git?
Recently we have moved our code base from SVN to Git.
But in git, we are facing an issue regarding 'file name too long'.
I would like to know: What is the maximum characters of a file name including the path supported by git?
Git itself has some hardcoded limits on path name length using the compile-time constant PATH_MAX
.1 This is typically 1024 or 4096 on a lot of systems. Consult the POSIX headers for the build machine used to build your particular Git binary. Some Windows builds apparently set this number to 260, even though many Windows systems can handle longer paths in various ways (see Filename too long in Git for Windows).
Your OS is another matter entirely. Many OSes and/or file systems place relatively short limits (e.g., 14, 63, or 255 characters) on path name components—the components are the part that goes between slashes and after the last slash (or whatever component-character your OS uses)—and some have very short limits on the whole path, despite having a PATH_MAX
of 1024 or more.
1This constant is misleading, and using it is not particularly wise. POSIX also provides a runtime call to get a maximum (see _POSIX_* (limits.h) vs _SC_* (sysconf)), which may return a different number, and which is also still misleading as the actual limit, if there is one at all, may be per-file-system. It would be best if Git just dynamically allocated paths as needed, in these places in the source. See https://eklitzke.org/path-max-is-tricky for some additional background.