Error Codes Wiki

Git for Windows — Filename Too Long Error and Path Length Limit

Warningapplication

About Git for Windows

Fix Git for Windows 'Filename too long' error caused by the 260-character Windows path length limit affecting clone, checkout, and pull operations. This guide covers everything you need to know about this topic, including common causes, step-by-step solutions, and answers to frequently asked questions.

Here are the key things to understand: 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. Understanding these fundamentals will help you diagnose and resolve this issue more effectively.

The most common reasons this occurs include: 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. Identifying the root cause is the first step toward finding the right solution.

To resolve this, follow these recommended steps: Enable Git long paths: 'git config --global core.longpaths true'. Enable Windows long paths: run 'reg add HKLM\SYSTEM\CurrentControlSet\Control\FileSystem /v LongPathsEnabled /t REG_DWORD /d 1 /f' as administrator. Alternatively, enable via Group Policy: Computer Configuration > Administrative Templates > System > Filesystem > Enable Win32 long paths. Clone repositories closer to the drive root (e.g., C:\repos) to reduce total path length. Restart your terminal and computer after enabling long path support. If these steps do not resolve the issue, consider consulting additional resources or a qualified professional.

This article is part of our Windows Error Codes collection on Error Codes Wiki. We provide comprehensive, up-to-date information to help you find solutions quickly.

Quick Answer

Why does Windows have a 260-character limit?

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.

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

  1. 1Enable Git long paths: 'git config --global core.longpaths true'
  2. 2Enable Windows long paths: run 'reg add HKLM\SYSTEM\CurrentControlSet\Control\FileSystem /v LongPathsEnabled /t REG_DWORD /d 1 /f' as administrator
  3. 3Alternatively, enable via Group Policy: Computer Configuration > Administrative Templates > System > Filesystem > Enable Win32 long paths
  4. 4Clone repositories closer to the drive root (e.g., C:\repos) to reduce total path length
  5. 5Restart your terminal and computer after enabling long path support

Tags

gitfilename-too-longpath-lengthwindowsnode-modules

More in Application

Frequently 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.