EmmyS
EmmyS

Reputation: 12148

git pull causing "unlink of file failed" error

I'm trying to do a git pull and am running into the dreaded "unlink of file xxx failed" error.

I've tried ProcessExplorer as defined in this answer; using the find function doesn't return any process using the file in question.

I've also tried running git gc as mentioned in this answer, and it runs, but I still get the error.

I have write permissions to the file in question.

Any other suggestions? This is causing a major problem.

Upvotes: 4

Views: 8125

Answers (3)

ccampos
ccampos

Reputation: 11

I just had that issue and also tried running git gc and made sure no process was using the files affected by unlink failed without success.

What solved my issue: right click on the folder containing the files > properties > Security tab. My user was missing in the list of "Group or user names". Adding it solved the issue.

My issue was not triggered by a pull but a checkout to another branch.

Hope it helps!

Upvotes: 0

VonC
VonC

Reputation: 1329082

That should be fixed in Git 2.8 (March 2016)

See commit d562102, commit dcacb1b, commit df617b5, commit 0898c96 (13 Jan 2016) by Johannes Schindelin (dscho).
(Merged by Junio C Hamano -- gitster -- in commit 3c80940, 26 Jan 2016)

fetch: release pack files before garbage-collecting

Before auto-gc'ing, we need to make sure that the pack files are released in case they need to be repacked and garbage-collected.

Many codepaths that run "gc --auto" before exiting kept packfiles mapped and left the file descriptors to them open, which was not friendly to systems that cannot remove files that are open.
They now close the packs before doing so.

That fixes git-for-widows issue 500.

Looking at the test used to validate that new approach, maybe you can (since Git 2.8 is not yet out) raise artificially gc.autoPackLimit.

git config gc.autoPackLimit 10000
git fetch
git config gc.autoPackLimit 50 # default value

Upvotes: 2

Vamsi Ravi
Vamsi Ravi

Reputation: 1236

Are you using the cmd ? If yes try git pull after switching to git-bash(run the bash.exe file in the GIT directory bin folder) which should not have any problem (the error related to Windows) and the git-bash is UNIX.

Upvotes: 0

Related Questions