Skip to content

Unlink of file '.git/...' failed #3336

@thany

Description

@thany
  • 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.32.0.windows.2
cpu: x86_64
built from commit: 3d45ac813c4adf97fe3733c1f763ab6617d5add5
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.19043.1110]

That's the 64 bits version, obviously.

  • 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

Editor Option: VisualStudioCode
Custom Editor Path:
Default Branch Option: master
Path Option: Cmd
SSH Option: OpenSSH
Tortoise Option: false
CURL Option: OpenSSL
CRLF Option: CRLFCommitAsIs
Bash Terminal Option: ConHost
Git Pull Behavior Option: Rebase
Use Credential Manager: Core
Performance Tweaks FSCache: Enabled
Enable Symlinks: Disabled
Enable Pseudo Console Support: Disabled
Enable FSMonitor: Enabled
  • Any other interesting things about your environment that might be related
    to the issue you're seeing?

I also use GitKraken, and this issues happens a lot while that's running, but also while it isn't (and even hasn't been sine the latest reboot). I also have VScode open all the time, which has a built-in Git client, but I'm not using it.

Details

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

CMD

git pull --rebase

But really many other commands trigger an automatic git gc, as you (authors) probably know ;)

  • What did you expect to occur after running these commands?

When git gc triggers automatically, don't complain when files can't be unlinked. As a user, I shouldn't have to care about that. Either git should ignore such problem (if it's harmless), or recover from it transparently.

  • What actually happened instead?
(after doing a successful command)

Auto packing the repository in background for optimum performance.
See "git help gc" for manual housekeeping.
Enumerating objects: 297431, done.
Counting objects: 100% (297431/297431), done.
Delta compression using up to 12 threads
Compressing objects: 100% (74044/74044), done.
Writing objects: 100% (297431/297431), done.
Total 297431 (delta 204855), reused 296282 (delta 203853), pack-reused 0
Unlink of file '.git/objects/pack/pack-2ebaef8c3398262c246a752a06git branch24602c42c80332.pack' failed. Should I try again? (y/n)

This "unlink" question repeats itself seemingly endlessly whether I answer yes or no. It's also impossible to know what the "right" answer is. Should I try again - I don't know, should you? Either way, answering yes just repeats the question for the same file. Answering no advances it to the next file, but god knows how many there are.

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

It's a general problem. Happens with multiple repo's, but most notably with very large ones. I wonder if this can happen with the repo for Git itself...

However, it does only happen after doing "some work". I'm not sure exactly when git gc triggers automatically, but it does. And I'm not sure when it decides unlinking a file cannot be done and bothers the user with it, but it will happen "at some point".

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