Skip to content

Regression in Git for Windows 2.54: fetch-triggered auto maintenance fails to unlink .git/objects/pack/*.idx with geometric maintenance #6210

@PatrykMis

Description

@PatrykMis

Existing issues matching what you're seeing

  • I was not able to find an open or closed issue matching what I'm seeing

Git for Windows version

git version 2.54.0.windows.1
cpu: x86_64
built from commit: 2b8a3ab140826ac423c2845ef81d4c6ac4f7bf3c
sizeof-long: 4
sizeof-size_t: 8
shell-path: D:/git-sdk-64-build-installers/usr/bin/sh
rust: disabled
feature: fsmonitor--daemon
gettext: enabled
libcurl: 8.19.0
OpenSSL: OpenSSL 3.5.6 7 Apr 2026
zlib: 1.3.2
SHA-1: SHA1_DC
SHA-256: SHA256_BLK
default-ref-format: files
default-hash: sha1

Windows version

Windows 10

Windows CPU architecture

x86_64 (64-bit)

Additional Windows version information

Microsoft Windows [Version 10.0.19045.7184]

Options set during installation

Editor Option: Notepad++
Custom Editor Path:
Default Branch Option:
Path Option: Cmd
SSH Option: OpenSSH
Tortoise Option: false
CURL Option: OpenSSL
CRLF Option: CRLFCommitAsIs
Bash Terminal Option: MinTTY
Git Pull Behavior Option: Merge
Use Credential Manager: Enabled
Performance Tweaks FSCache: Enabled
Enable Symlinks: Disabled
Enable FSMonitor: Disabled

Other interesting things

This seems to be a regression in Git for Windows 2.54.0.windows.1.

The issue appears to be isolated to fetch-triggered auto-maintenance when the geometric maintenance strategy is enabled.

The repository itself appears healthy:

git fsck --full

succeeds.

Also:

git gc --prune=now --aggressive

succeeds.

The failure does not seem to be caused by general repository corruption or by a normal git gc failure.

The following individual maintenance tasks also complete successfully when run manually:

git maintenance run --task=incremental-repack
git maintenance run --task=commit-graph
git maintenance run --task=pack-refs
git maintenance run --task=loose-objects
git maintenance run --task=gc

This suggests that the failure is probably not in one individual maintenance task by itself, but rather in the full auto-maintenance sequence / orchestration after git fetch.

The workaround is:

git config --global maintenance.strategy gc

Alternatively:

git fetch --no-auto-maintenance

also avoids the failure.

Terminal/shell

bash, cmd, powershell

Commands that trigger the issue

git fetch
git fetch --all
git fetch --all -p --tags -f

Expected behaviour

git fetch should complete successfully.

It should not fail while trying to unlink .idx files from .git/objects/pack/ during cleanup or auto-maintenance.

Actual behaviour

After upgrading to Git for Windows 2.54.0.windows.1 / 2.54.0-1, git fetch intermittently fails with:

Unlink of file '.git/objects/pack/pack-<hash>.idx' failed. Should I try again?

The failing files are always under:

.git/objects/pack/*.idx

This happens only in some repositories and only with Git for Windows 2.54.

The problem is independent of the shell: it reproduces in Git Bash, CMD and PowerShell.

Running as Administrator does not change the behavior.

I also checked for external file handles and did not find any external process keeping the affected files open. The files can be copied, moved and deleted normally from Explorer outside of the failing Git operation.

Important isolation details:

git fetch --no-auto-maintenance

succeeds.

Also, when geometric maintenance is avoided, the same fetch operation succeeds, for example:

git -c maintenance.strategy=gc fetch

or after configuring:

git config --global maintenance.strategy gc

the problem no longer reproduces.

This strongly suggests that the issue is in the fetch-triggered auto-maintenance path, specifically when the geometric maintenance strategy is involved.

Possible cause:

This looks like a Windows-specific handle/lifecycle issue in the fetch-triggered auto-maintenance sequence. One part of the maintenance sequence may still have an open handle to a pack index file while a later cleanup step tries to unlink the same .idx file.

Why this looks like a regression:

  • The problem started after upgrading to Git for Windows 2.54.
  • It does not reproduce when geometric maintenance is disabled.
  • It does not reproduce with git fetch --no-auto-maintenance.
  • The repository passes git fsck --full.
  • Manual aggressive GC succeeds.
  • Individual maintenance tasks succeed.
  • The failure is limited to .git/objects/pack/*.idx cleanup during fetch-triggered maintenance.

Repository

Normal local working tree, non-bare repository.

The affected repositories are private, but I can provide additional diagnostic output if needed, such as:

git config --show-origin --get-regexp "^(maintenance|gc|fetch|core\.fsmonitor|feature)\."
git count-objects -vH

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions