Skip to content
Nilay Kabariya

Entry No.073·Fixes··2 min read

Fix: git 'Filename too long' on Windows (clone, checkout)

git clone fails on Windows with Filename too long and unable to checkout working tree. Reproduced with a 286-character path, plus how to rescue the clone.

The error, verbatim

Jump to the fix ↓
error: unable to create file node_modules/@some-scope/…/an-equally-long-file-name-for-the-generated-component-module.js: Filename too long
fatal: unable to checkout working tree
✓ Reproduced on Windows 11 Pro (LongPathsEnabled = 1)

Tested on

git
2.54.0.windows.1
Node
24.14.0
OS
Windows 11 Pro (LongPathsEnabled = 1)
Contents
  1. Clone with long paths on01
  2. Rescue a clone that already failed02
  3. A long file name gives a different error03
  4. How this was tested04

Windows historically limits a full file path to 260 characters. Git for Windows keeps that limit by default, even when Windows itself would allow longer paths. A repository with deep folders (a committed node_modules, generated code, a monorepo nested inside another folder) passes the limit, and the clone stops half-way:

error: unable to create file node_modules/@some-scope/…/an-equally-long-file-name-for-the-generated-component-module.js: Filename too long
fatal: unable to checkout working tree

My test repository had one file whose full path was 286 characters. The clone created the repository but not the files: git status then showed that file as deleted.

Clone with long paths on

Switch on git’s long-path support for that clone:

git clone -c core.longpaths=true <url>

To make it the default for every repository on your machine, set it once:

git config --global core.longpaths true

Rescue a clone that already failed

No need to clone again. Inside the half-checked-out repository:

git config core.longpaths true
git restore --source=HEAD --staged --worktree :/

A long file name gives a different error

The 260-character limit is about the whole path. A single file or folder name over 255 characters is a separate limit, and on Windows Node didn’t report it as “too long”: writing a 256-character file name failed with

ENOENT: no such file or directory, open 'D:\nk-longpath\xxxx…'

A 250-character name worked. If you see ENOENT for a file you’re creating (not reading), check the length of its name.

How this was tested

Windows 11 Pro with Git for Windows and Node 24.14.0, October 18, 2026. A local repository with one file at a 286-character path was committed with long paths on, then cloned into a fresh folder with default settings and with long paths on, and repaired after a failed clone as shown. Long names were tested with Node’s fs.writeFileSync at 250, 256 and 300 characters. No global git settings or Windows settings were changed for the test. Every message above is the real output.

— N.K., end of entry No.073

Useful? Pass it on:Post on XFollow @EmotionalMatter

Related entries

  1. No.069

    Fix: EBUSY: resource busy or locked (npm, Windows)

    npm install and Node fail on Windows with EBUSY: resource busy or locked, rmdir. Reproduced: what holds the folder, how to find it, and why retrying fails.

    > npm error code EBUSY

    FIXED3 minWindows
  2. No.094

    Python CERTIFICATE_VERIFY_FAILED, tested on 3.12 to 3.15

    certificate verify failed: unable to get local issuer certificate, or Basic Constraints of CA cert not marked critical on Python 3.13+. Each cause tested.

    > requests.exceptions.SSLError: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/

    FIXED3 minWindows
  3. No.093

    Fix: bigint Failed to load bindings, pure JS will be used

    bigint: Failed to load bindings, pure JS will be used. Why npm 12 shows it on every install, whether it matters, and how to get the native build back.

    > bigint: Failed to load bindings, pure JS will be used (try npm run rebuild?)

    FIXED3 minWindows
  4. No.075

    Python was not found, or pip not recognized (Windows fix)

    "Python was not found" comes from a Microsoft Store placeholder python.exe, not Python, and exits with 9009. How to see which python.exe wins, and the pip fix.

    > Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Apps > Advanced app settings > App execution aliases.

    FIXED3 minWindows

Post card · Every Sunday

What broke this week.

One email on Sundays: the Node, TypeScript, Python and AI SDK releases that broke builds that week, each one reproduced, with a link to the fix that worked. Never shared, and you can leave any time.

— Nilay

or follow by RSSor on X

By subscribing you agree to the privacy note. One click to leave.

tip: paste the exact error text