Git 'filename too long' error on OS X

4.5k Views Asked by At

I have a directory that is tracked by git on linux and I copied it to mac OS. On git status multiple files are untracked because of a filename: File name too long error. One filename (with its relative path) is 393 characters. Isn't there a limit 4096 characters (except on Windows)? [Reference] My core.longpaths setting is set to true. (Also so is core.precomposeunicode set to true, but probably irrelevant). Any advice?

2

There are 2 best solutions below

0
On BEST ANSWER

OS X has NAME_MAX (bytes in a path name component) set to 255:

$ grep NAME_MAX /usr/include/sys/syslimits.h
#define NAME_MAX          255   /* max bytes in a file name */
#define CHARCLASS_NAME_MAX     14   /* max character class name size */

Is that 393 byte name a single component, or the entire path? (Example: "foo/bar/baz" has 3 components that are each 3 bytes, and the entire path is 11 or 12 bytes depending on whether you count the terminating '\0'. The NAME_MAX constant here does not count a terminating '\0'.)

0
On

Other option is change symlink configuration for your project, and you don't need change system vars.

Use the console and use this commands:

I take the answer from:

https://github.com/Urigo/IonicCLI-Meteor-WhatsApp/issues/4#issuecomment-382957742