Enable Long Paths in Windows 10/11 to Fix Developer Build and Git Errors
Difficulty: Intermediate | Time Required: 10 minutesModern development projects can create very deep folder structures. If you work with Git, Node.js, Java, .NET, Python virtual environments, package managers, generated code, or large monorepos, you may eventually run into errors such as:
Filename too longThe specified path, file name, or both are too longfatal: cannot create directory at ... Filename too long- Build failures when restoring packages or generating output files
MAX_PATH limit of 260 characters. Windows 10 and Windows 11 can support longer paths, but the feature must be enabled, and the application must also be capable of using it. This tutorial walks you through enabling long paths in Windows and adding the matching Git setting that often fixes clone, checkout, and build errors.Prerequisites
Before you begin, make sure you have:- Windows 10 version 1607 or later, or Windows 11.
- Administrator access to change system settings.
- Git for Windows installed, if your issue is Git-related.
- A few minutes to restart your PC or at least restart affected apps.
Note: Windows Home editions usually do not include the Local Group Policy Editor. If you are using Windows Home, use the Registry or PowerShell method below.
Step 1: Confirm That Long Paths Are the Likely Problem
Before changing system settings, check whether your error looks path-related.Common examples include:
error: unable to create file some/deeply/nested/folder/example.txt: Filename too longThe specified path, file name, or both are too long.fatal: cannot create directory at '...': Filename too longThis often happens when a project is stored inside an already long folder path, such as:
C:\Users\YourName\Documents\Work\Clients\Project Archives\2026\Some Very Long Project Name\If the repository itself also contains deep folders, the full path can exceed what older tools expect.
Tip: For development work, consider using a short root folder such asC:\src,C:\dev, orD:\repos. Even after enabling long paths, shorter paths make builds and scripts more reliable.
Step 2: Enable Long Paths Using Group Policy
Use this method if you are on Windows 10/11 Pro, Enterprise, or Education.- Press Windows + R.
- Type:
gpedit.msc - Press Enter.
- In Local Group Policy Editor, browse to:
Code:Computer Configuration └ Administrative Templates └ System └ Filesystem - Double-click Enable Win32 long paths.
- Select Enabled.
- Click Apply.
- Click OK.
- Close the Local Group Policy Editor.
Important: Enabling the Windows setting does not automatically make every app support long paths. Applications must be written or configured to use the newer long-path behavior.
Step 3: Enable Long Paths Using PowerShell
If you are on Windows Home, or if you prefer command-line configuration, use PowerShell.- Right-click the Start button.
- Select Terminal (Admin) or Windows PowerShell (Admin).
- If prompted by User Account Control, click Yes.
- Run the following command:
Code:New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" ` -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force - To confirm the setting, run:
Code:Get-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" ` -Name "LongPathsEnabled" - Check that the value is:
LongPathsEnabled : 1
Warning: Be careful when editing the Registry. The command above changes only the documented long-path setting, but incorrect Registry edits elsewhere can cause Windows problems.
Step 4: Restart Windows or Restart Affected Apps
After enabling long paths, restart your computer.A full reboot is recommended because some running processes may have already cached the old setting. If you cannot reboot immediately, close and reopen:
- Windows Terminal
- Command Prompt
- PowerShell
- Visual Studio or Visual Studio Code
- Git Bash
- Build tools, package managers, and IDEs
Step 5: Enable Long Paths in Git for Windows
Windows long-path support and Git long-path support are related, but they are not the same setting. If your error happens duringgit clone, git checkout, git pull, or git status, configure Git as well.- Open Git Bash, Command Prompt, or Windows Terminal.
- Run:
git config --global core.longpaths true - Verify the setting:
git config --global --get core.longpaths - You should see:
true
git config --system core.longpaths trueTo see where Git is reading the setting from, use:
git config --show-origin --get core.longpathsTip: If a clone already failed halfway through, delete the incomplete folder and clone again after applying the setting. A partially checked-out repository may still be missing files.
Step 6: Test the Project Again
Now retry the operation that failed.For example:
git clone <repository>Or, inside an existing project:
git pullThen rerun your build command, such as:
npm installdotnet restoremvn clean installgradlew buildIf the issue was caused by Windows or Git path-length handling, the operation should now get further or complete successfully.
Tips and Troubleshooting
Some Applications Still May Not Work
Long paths require support from both Windows and the application. Older tools, older installers, legacy build scripts, or apps that do not opt in may still fail. If one tool fails but another works, update the failing tool first.Use a Short Development Folder
Even with long paths enabled, using a short folder path is a smart habit:C:\src\projectis safer than:
C:\Users\YourName\Documents\Company Files\Development\Archived Client Projects\projectThis is especially helpful for Node.js projects, monorepos, generated code, and package restore folders.
Check Local Git Overrides
A repository can have local Git configuration that differs from your global setting. Inside the repository, run:git config --get core.longpathsIf needed, set it locally:
git config core.longpaths trueCorporate Devices May Override the Setting
On domain-joined or managed PCs, Group Policy or device management may override your local changes. If the setting keeps reverting, contact your IT administrator.File Explorer May Behave Differently Than Developer Tools
Long-path support is most relevant to compatible applications and APIs. You may still encounter odd behavior in older shell extensions, file dialogs, backup tools, archive utilities, or legacy programs.Re-clone After Changing Settings
If Git failed during checkout, the working tree may be incomplete. After enabling long paths, the cleanest fix is often:- Delete the failed clone.
- Open a new terminal.
- Clone into a short folder such as
C:\src. - Run the build again.
Conclusion
Enabling long paths in Windows 10 or Windows 11 is a quick fix that can save developers from frustrating Git, build, and package restore errors. For best results, enable the Windows setting, configure Git for Windows withcore.longpaths, restart your tools or PC, and keep development projects in short root folders.Key Takeaways:
- Windows 10 version 1607 and later, plus Windows 11, can support paths longer than the classic 260-character limit.
- Enable Win32 long paths through Group Policy or the Registry.
- Git for Windows may also need
core.longpathsset totrue. - Some older applications may still fail unless they support long paths.
- Short development folders such as
C:\srcremain a good best practice.
This tutorial was generated to help WindowsForum.com users get the most out of their Windows experience.
Structured References
- Microsoft Learn — Maximum Path Length Limitation
- Microsoft Learn — Policy CSP - ADMX_FileSys: LongPathsEnabled
- Git for Windows — Git cannot create a file or directory with a long path (gitforwindows.org)
References
- Citation: gitforwindows.org
Git cannot create a file or directory with a long path
We bring the awesome Git VCS to Windowsgitforwindows.org
- Related coverage: w3tutorials.net
Filename Too Long in Git for Windows: Why `core.longpaths true` Isn't Working (Node_modules & Yeoman Angular Fix)
If you’re a developer working on Windows with Git, you’ve likely encountered the dreaded "filename too long" error. This issue is especially common in projects with deeply nested directories—think `node_modules` or Yeoman-generated Angular apps—where path lengths easily exceed Windows’...www.w3tutorials.net
- Related coverage: stackoverflow.com
Filename too long in Git for Windows
I'm using Git-1.9.0-preview20140217 for Windows. As I know, this release should fix the issue with too long filenames. But not for me. Surely I'm doing something wrong: I did git config core.longpa...stackoverflow.com
- Related coverage: dothanhlong.org
- Related coverage: git.kmx.io
- Official source: gist.github.com
Git cannot create a file or directory with a long path - Windows OS
Git cannot create a file or directory with a long path - Windows OS - git_add_file_with_long_name_windows_os.mdgist.github.com
- Related coverage: speclan.net
Windows: Long Path and Filename Too Long Errors When Cloning SPECLAN
Fix Windows clone, checkout, pull, and branch-switch errors caused by the 260-character path limit. Includes the one-line git config --global core.longpaths true remediation, why SPECLAN's long descriptive filenames hit the limit, and troubleshooting if the setting doesn't take effect.speclan.net
- Related coverage: rokojori.com
- Related coverage: gitee.com
Login - Gitee.com
Gitee.com(码云) 是 OSCHINA.NET 推出的代码托管平台,支持 Git 和 SVN,提供免费的私有仓库托管。目前已有超过 1400万的开发者选择 Gitee。gitee.com
- Related coverage: gitextensions.readthedocs.io
- Related coverage: pydistcheck.readthedocs.io
- Related coverage: git-extensions-documentation.readthedocs.io
- Related coverage: arxiv.org
Derived autoequivalences of length 2 flops via GIT
We obtain the derived autoequivalences of a flopping rational curve of length 2 using GIT and the theory of windows applied to the universal length 2 flop. We show that the stringy Kähler moduli space (SKMS) associated to the GIT problem, as constructed by Halpern-Leistner--Sam, matches the...
arxiv.org