Quickfix: Git failed with a fatal error. Filename too long on Windows

Here is a fun error I got last week while trying to clone a git repository to my file system.

The error is a bit vague. But when I looked into the error details I saw:

error: unable to create file applications/backend/apps/identity-provider/Identity.Repository/Service References/MyCustomIdentityServiceReference/MyService.Repository.MyCustomIdentityServiceReference.DT_ServiceProviderResource.Internal.datasource: 
Filename too long

The last part in the error details is what gave it away: The file name is too long. Git is unable to clone all the files on the system.

For the record: I’m using a Windows machine. So there is an issue with file paths being too long for Windows. Here is how to fix that.

Change the max allowed path name

Luckly you can change the setting to allow long filepath names in windows. To do so you must edit the git config to allow long path names.

Run the following command to set the longspaths setting to true in the git global config:

Leave a Reply