0

I'm trying to clone a Git repository on a Windows machine that has an NTFS volume.

Unfortunately I get several errors:

error: unable to create file (...) Filename too long

The files in question are indeed very long but, according to what I know about NTFS, it should still work.

For example:

  • file name is: 151 characters
  • absolute filepath (including file name): 262 characters

This should still be accceptable and git clone should work. From what I found online and in NTFS documentation, restrictions are:

  • max filename length: 255 characters
  • max absolute path: ~32,000 characters

How come I can not clone that repository on a NTFS volume?

2

1 Answer 1

2

You're probably hitting not NTFS storage restrictions, but Win32 API restrictions. The maximum path length that can be given to the OS functions such as CreateFile() (at Win32 layer) is a filesystem-independent limit of 260 characters total.

This has its own article at Microsoft Docs:

Fortunately, recent Windows versions have raised the API limit to 32k characters – but you have to opt in through a Registry setting. How to do this is described in the same article (I faintly remember that Git for Windows' installer offers to automatically enable this option as well).

1
  • Thanks. While that makes perfect sense and it seems like it should solve the problem -> I applied it -> still doesn't work :( . And that's after a reboot as well. Strange... Commented Aug 12, 2022 at 7:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .