I am trying to remove whole git repository from my local machine, but git prohibits to delete several files.
I\'ve tried:
rm -r folder
Close any git clients that might be running.
Set the permissions to delete first:
chmod -R 777 folder
Try to force the deletion:
rm -rf folder
The following command may help:
chmod -R u+w folder/
Also make sure you own all the files which you're trying to remove:
chown -R $USER folder/
On Linux it may be also a file attribute (check by lsattr
):
chattr -R -AacdDijsStu folder/
So I figured it out. The problem was that on my host machine (windows 7 x64) this folder was allowed to read only. I disabled it, and removed it from the host machine. Sorry for not saying that it was mounted, and thanks for all replies : )
In my case, for some reason the user immutable flag (uchg) was switched on for everything in the .git folder. This fixed it:
chflags -R nouchg folder/
I could then delete with rm -rf folder/
.