0

I have tmp .git files that I can't remove no matter what I try.

I've tried chmod and rm from terminal:

chmod a+wx zzz_delete/
seth-laptop:Lepton_Master Seth_Mac$ sudo rm -rf zzz_delete/
rm: zzz_delete//.git/objects/tmp_object_git2_a03228: Permission denied

I ran a bash script to force chmod:

chmod: Unable to change file mode on /zzz_delete/.git/objects/tmp_object_git2_a03228: Operation not permitted

I tried delete from a Windows Machine. Permission Denied.

How can I change permissions and remove this tricky folder?

sweeds
  • 539
  • 6
  • 18

1 Answers1

0

It exists a special attribute that do not allow even to root to delete the file.
Try to see if the Immutable Bit was set on the file with:

lsattr /zzz_delete/.git/objects/tmp_object_git2_a03228

If it answers with something like

----i-------- tmp_object_git2_a03228

gotcha! You have just to unset it before removing:

sudo chattr -i nomefile

What is the Immutable Bit : The immutable bit can be used to prevent accidentally deleting or overwriting a file that must be protected. It also prevents someone from creating a hard link to the file. See the chattr(1) man page for information on the immutable bit.

Hastur
  • 2,470
  • 27
  • 36