Enable Long Paths in Windows 10/11 to Fix Developer Build and Git Errors

Enable Long Paths in Windows 10/11 to Fix Developer Build and Git Errors​

Difficulty: Intermediate | Time Required: 10 minutes
Modern 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 long
  • The specified path, file name, or both are too long
  • fatal: cannot create directory at ... Filename too long
  • Build failures when restoring packages or generating output files
Historically, many Windows applications were affected by the classic 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:
  1. Windows 10 version 1607 or later, or Windows 11.
  2. Administrator access to change system settings.
  3. Git for Windows installed, if your issue is Git-related.
  4. 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 long
The specified path, file name, or both are too long.
fatal: cannot create directory at '...': Filename too long
This 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 as C:\src, C:\dev, or D:\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.
  1. Press Windows + R.
  2. Type:
    gpedit.msc
  3. Press Enter.
  4. In Local Group Policy Editor, browse to:
    Code:
    Computer Configuration
    └ Administrative Templates
      └ System
        └ Filesystem
  5. Double-click Enable Win32 long paths.
  6. Select Enabled.
  7. Click Apply.
  8. Click OK.
  9. Close the Local Group Policy Editor.
This setting allows long path support for compatible Win32 applications.
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.
  1. Right-click the Start button.
  2. Select Terminal (Admin) or Windows PowerShell (Admin).
  3. If prompted by User Account Control, click Yes.
  4. Run the following command:
    Code:
    New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" `
    -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force
  5. To confirm the setting, run:
    Code:
    Get-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" `
    -Name "LongPathsEnabled"
  6. Check that the value is:
    LongPathsEnabled : 1
This changes the same system setting that Group Policy controls.
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:
  1. Windows Terminal
  2. Command Prompt
  3. PowerShell
  4. Visual Studio or Visual Studio Code
  5. Git Bash
  6. Build tools, package managers, and IDEs
For stubborn build problems, reboot before testing again.

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 during git clone, git checkout, git pull, or git status, configure Git as well.
  1. Open Git Bash, Command Prompt, or Windows Terminal.
  2. Run:
    git config --global core.longpaths true
  3. Verify the setting:
    git config --global --get core.longpaths
  4. You should see:
    true
If you manage a shared development machine or build agent, you may prefer a system-wide Git setting. Open your terminal as Administrator and run:
git config --system core.longpaths true
To see where Git is reading the setting from, use:
git config --show-origin --get core.longpaths
Tip: 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 pull
Then rerun your build command, such as:
npm install
dotnet restore
mvn clean install
gradlew build
If 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\project
is safer than:
C:\Users\YourName\Documents\Company Files\Development\Archived Client Projects\project
This 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.longpaths
If needed, set it locally:
git config core.longpaths true

Corporate 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:
  1. Delete the failed clone.
  2. Open a new terminal.
  3. Clone into a short folder such as C:\src.
  4. 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 with core.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.longpaths set to true.
  • Some older applications may still fail unless they support long paths.
  • Short development folders such as C:\src remain 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​

  1. Citation: gitforwindows.org
  2. Related coverage: w3tutorials.net
  3. Related coverage: stackoverflow.com
  4. Related coverage: dothanhlong.org
  5. Related coverage: git.kmx.io
  6. Official source: gist.github.com
  1. Related coverage: speclan.net
  2. Related coverage: rokojori.com
  3. Related coverage: gitee.com
  4. Related coverage: gitextensions.readthedocs.io
  5. Related coverage: pydistcheck.readthedocs.io
  6. Related coverage: git-extensions-documentation.readthedocs.io
  7. Related coverage: arxiv.org
 

Back
Top