简体   繁体   English

rm -rf 失败时如何删除 .git 目录?

[英]How to remove .git directory when rm -rf fails?

I am trying to remove the git files associated with a project by running:我正在尝试通过运行来删除与项目关联的 git 文件:

[#]: rm -rf .git

I get the following result:我得到以下结果:

rm: cannot remove ‘.git/hooks’: Directory not empty

Looking in .git/hooks I have tried to see ls -l what is there and I get this weird response:查看.git/hooks我试图查看ls -l那里有什么,但我得到了这个奇怪的响应:

ls: cannot access commit-msg.sample: No such file or directory
ls: cannot access pre-rebase.sample: No such file or directory
ls: cannot access applypatch-msg.sample: No such file or directory
ls: cannot access pre-commit.sample: No such file or directory
ls: cannot access update.sample: No such file or directory
ls: cannot access pre-applypatch.sample: No such file or directory
ls: cannot access post-update.sample: No such file or directory
applypatch-msg.sample  pre-applypatch.sample  update.sample
commit-msg.sample      pre-commit.sample
post-update.sample     pre-rebase.sample

I have tried to remove these files individually and that does not work either.我试图单独删除这些文件,但也不起作用。 Eg:例如:

[#]: rm applypatch-msg.sample
rm: cannot remove ‘applypatch-msg.sample’: No such file or directory

How can I remove this git directory from the project?如何从项目中删除这个 git 目录?

I am trying to remove the git files associated with a project by running:我正在尝试通过运行来删除与项目关联的 git 文件:

[#]: rm -rf .git

I get the following result:我得到以下结果:

rm: cannot remove ‘.git/hooks’: Directory not empty

Looking in .git/hooks I have tried to see ls -l what is there and I get this weird response:查看.git/hooks我试图查看ls -l那里有什么,但我得到了这个奇怪的响应:

ls: cannot access commit-msg.sample: No such file or directory
ls: cannot access pre-rebase.sample: No such file or directory
ls: cannot access applypatch-msg.sample: No such file or directory
ls: cannot access pre-commit.sample: No such file or directory
ls: cannot access update.sample: No such file or directory
ls: cannot access pre-applypatch.sample: No such file or directory
ls: cannot access post-update.sample: No such file or directory
applypatch-msg.sample  pre-applypatch.sample  update.sample
commit-msg.sample      pre-commit.sample
post-update.sample     pre-rebase.sample

I have tried to remove these files individually and that does not work either.我试图单独删除这些文件,但也不起作用。 Eg:例如:

[#]: rm applypatch-msg.sample
rm: cannot remove ‘applypatch-msg.sample’: No such file or directory

How can I remove this git directory from the project?如何从项目中删除这个 git 目录?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在没有rm -rf sledgehammer的情况下删除单个git存储库克隆? - How to delete a single git repository clone, without the rm -rf sledgehammer? 如何使用rm -rf从目录中删除文件? - How to delete files from directory using rm -rf? 如何确定运行rm -rf时释放的空间量 - How to determine the amount of space that comes free when running rm -rf 如何在Linux上清除c ++中的目录内容(基本上,我想做'rm -rf <directorypath> / *' - How to clear directory contents in c++ on Linux (basically, i want to do 'rm -rf <directorypath>/*' Java删除文件/目录,等同于linux“ rm -rf / tmp / garbagedir *” - Java delete file/directory equivalent of linux “rm -rf /tmp/garbagedir*” 仅RM -rf文件 - RM -rf Files only xarg,find和rm rm:无法删除`./not&#39;:没有这样的文件或目录 - xarg, find and rm rm: cannot remove `./not': No such file or directory 文件夹似乎存在于操作系统中,但在“sudo rm -rf dirname”时静默失败 - Folder seems to exist in OS but fails silently upon `sudo rm -rf dirname` 尝试从sh`echo&#39;rm -rf!(cookbooks)&#39;使用bash时出现语法错误 重击 - Syntax error when I try to use bash from sh `echo 'rm -rf !(cookbooks)' | bash` rm -rf /* 立即关闭 Linux AWS - Linux AWS immediately down by rm -rf /*
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM