Skip to content

Windows Longpath support does not fully work? Error: "fatal: '$GIT_DIR' too big" #3372

@skdsp

Description

@skdsp
  • [ x] I was not able to find an open or closed issue matching what I'm seeing

Setup

  • Which version of Git for Windows are you using? Is it 32-bit or 64-bit?
$ git --version --build-options

git version 2.31.1.windows.1
cpu: x86_64
built from commit: c5f0be26a7e3846e3b6268d1c6c4800d838c6bbb
sizeof-long: 4
sizeof-size_t: 8
shell-path: /bin/sh
feature: fsmonitor--daemon

 - Which version of Windows are you running? Vista, 7, 8, 10? Is it 32-bit or 64-bit?

$ cmd.exe /c ver

Microsoft Windows [Version 10.0.18363.1679]

  • What options did you set as part of the installation? Or did you choose the
    defaults?
# One of the following:
> type "C:\Program Files\Git\etc\install-options.txt"
> type "C:\Program Files (x86)\Git\etc\install-options.txt"
> type "%USERPROFILE%\AppData\Local\Programs\Git\etc\install-options.txt"
$ cat /etc/install-options.txt

** insert your machine's response here **
Editor Option: Notepad++
Custom Editor Path: 
Default Branch Option:  
Path Option: Cmd
SSH Option: OpenSSH
Tortoise Option: false
CURL Option: WinSSL
CRLF Option: CRLFCommitAsIs
Bash Terminal Option: ConHost
Git Pull Behavior Option: Merge
Use Credential Manager: Enabled
Performance Tweaks FSCache: Enabled
Enable Symlinks: Disabled
Enable Pseudo Console Support: Disabled


 - Any other interesting things about your environment that might be related
   to the issue you're seeing?

Longpaths activated (C:\Program Files\Git\etc\gitconfig): 	
[core] 
  longpaths = true 

### Details

 - Which terminal/shell are you running Git from? e.g Bash/CMD/PowerShell/other

git bash (MINGW64)

 - What commands did you run to trigger this issue? If you can provide a
   [Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve)
   this will help us understand the issue.

** insert your commands here **

  1. Cloning a Git Repo into a folder with an already long path
    git clone -c core.longpaths=true https://github.com/git/git.git --recurse-submodules //?/D:/eval/Git_Test/looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong
  2. Cloning a Git Repo with multiple levels of submodules (nested submodules). Here we are really running into issues with levels of e.g. 6 nested submodules, when trying to clone into already very short pathes. Shortening paths within the submodules is only solving temporally the issue. I'd like to have something that is really future proof.
    git clone -c core.longpaths=true --recurse-submodules //?/
  • What did you expect to occur after running these commands?

All Repos with submodules are fetched recursively.

  • What actually happened instead?

Error message: fatal: '$GIT_DIR' too big.
The error seems to point to a define (PATH_MAX) in setup.c code (https://github.com/git/git/blob/54e85e7af1ac9e9a92888060d6811ae767fea1bc/setup.c#L812)
Thus I am afraid the PATH_MAX is set to 260 for the installation already?

  • If the problem was occurring with a specific repository, can you provide the
    URL to that repository to help us with testing?

e.g. https://github.com/git/git.git

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions