Git for Windows — Filename Too Long Error and Path Length Limit
Warningapplication
Overview
Fix Git for Windows 'Filename too long' error caused by the 260-character Windows path length limit affecting clone, checkout, and pull operations.
Key Details
- Windows has a default maximum path length of 260 characters (MAX_PATH)
- Git repositories with deeply nested directories or long filenames exceed this limit
- Node.js projects with node_modules are especially prone to exceeding the path limit
- Windows 10 version 1607+ supports long paths but requires explicit enablement
- Git for Windows has its own setting to handle long paths independently of the system setting
Common Causes
- Repository containing file paths exceeding 260 characters total
- node_modules deep nesting creating extremely long paths
- Git core.longpaths not enabled in Git configuration
- Windows long path support not enabled in Group Policy or registry
Steps
- 1Enable Git long paths: 'git config --global core.longpaths true'
- 2Enable Windows long paths: run 'reg add HKLM\SYSTEM\CurrentControlSet\Control\FileSystem /v LongPathsEnabled /t REG_DWORD /d 1 /f' as administrator
- 3Alternatively, enable via Group Policy: Computer Configuration > Administrative Templates > System > Filesystem > Enable Win32 long paths
- 4Clone repositories closer to the drive root (e.g., C:\repos) to reduce total path length
- 5Restart your terminal and computer after enabling long path support
Tags
gitfilename-too-longpath-lengthwindowsnode-modules
More in Application
windows-C0000005-access-violationWindows Error 0xC0000005 — Access Violation
Errorwindows-C000007B-bad-image-formatWindows Error 0xC000007B — Bad Image Format
Errorwindows-C0000142-application-init-failedWindows Error 0xC0000142 — Application Init Failed
Errorwindows-SxS-Error-side-by-side-configuration-errorWindows Error SxS-Error — Side-by-Side Configuration Error
Warningwindows-DLL-Missing-dll-not-foundWindows Error DLL-Missing — DLL Not Found
Warningwindows-app-runtime-r6025Windows Runtime Error R6025 — Pure Virtual Function Call
WarningFrequently Asked Questions
The MAX_PATH constant (260 chars) is a legacy limitation from the Windows API. Modern Windows supports paths up to 32,767 characters but requires explicit opt-in for backward compatibility.