![无法删除 .git 目录](https://linux22.com/image/1158088/%E6%97%A0%E6%B3%95%E5%88%A0%E9%99%A4%20.git%20%E7%9B%AE%E5%BD%95.png)
我尝试运行sudo rm -rf .git/
但终端返回以下消息:
rm: cannot remove ‘.git/objects/pack/pack-3818f69fa7bd64ef22c94c0bf630c18333cd5da9.idx’: Operation not permitted
rm: cannot remove ‘.git/objects/pack/pack-3818f69fa7bd64ef22c94c0bf630c18333cd5da9.pack’: Operation not permitted
另外,我尝试运行chattr -i filename
,但它也返回错误:
chattr: Inappropriate ioctl for device while reading flags on .git/objects/pack/pack-3818f69fa7bd64ef22c94c0bf630c18333cd5da9.idx
答案1
找到了一个解决方案:我只是将 .git 文件夹重命名为另一个名称并将其删除。