Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

unable to unlink .git/objects/...: Operation not permitted

Tags:

git

When pulling from my remote develop branch, I get a long series of messages like this:

unable to unlink .git/objects/fe/4f55215c297e73e7115d0792257155fa1a0307: Operation not permitted

I shut down IntelliJ and all other open editors as suggested here, but the error persisted. I tried to chflags on all files, as written here, but it did nothing. I also tried chowning all files to my user and forcing write permissions with chmod both on files and on the directory itself, recursively (both from my user and sudo, I tried simply +x, then 775), but to no avail.

I cannot get rid of these messages. This happens only when pulling develop. Other branches are fine.

like image 621
Totem Avatar asked Mar 18 '26 16:03

Totem


1 Answers

I get this quite often at work. Our team consists of 2 windows, 3 linux and 1 ios users. Somewhere, someone is pushing files with dodgy permissions which causes the live Linux server to throw a hissy sometimes.

What I've always found fixes this is simply removing the gc.log file, i.e

rm .git/gc.log

Then on your next pull all the errors will be gone. What I think actually happens is the files do get unlinked in the first place, however the log file isn't updated correctly, so then on the next pull it try's to remove them again even thought they do not exists and throws an error.

like image 102
Doug Avatar answered Mar 21 '26 07:03

Doug



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!