git clone失败后无法删除文件夹

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/31451165/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 11:12:15  来源:igfitidea点击:

Can't delete folder after failed git clone

gitwindows-7cygwin

提问by graham o'donnel

I'm trying to clone a git repo. I'm using cygwin on a windows 7 OS. Somehow, it fails, but create a folder. When I try to delete it, got this message:

我正在尝试克隆一个 git repo。我在 Windows 7 操作系统上使用 cygwin。不知何故,它失败了,但创建了一个文件夹。当我尝试删除它时,收到以下消息:

rmdir: fallo al borrar ?myRepoName/?: Device or resource busy

rmdir: fallo al borrar ?myRepoName/?: 设备或资源繁忙

I can't delete it even using the windows explorer.

即使使用 Windows 资源管理器,我也无法删除它。

?What does it means this message, and how can I delete these folders?

?这条消息是什么意思,我该如何删除这些文件夹?

采纳答案by rholmes

Make sure that no shells, Windows explorer windows or applications are open to anything in the git subtree and try again. Next, close all your apps and try again. If that doesn't work, reboot and try again. Windows is overly protective of open files and directories, and some apps don't close them properly.

确保没有外壳、Windows 资源管理器窗口或应用程序对 git 子树中的任何内容打开,然后重试。接下来,关闭所有应用程序并重试。如果这不起作用,请重新启动并重试。Windows 过度保护打开的文件和目录,有些应用程序无法正确关闭它们。

回答by Kraig Lutz

I know this is a bit old but hopefully this helps someone else who experiences this issue.

我知道这有点旧,但希望这可以帮助遇到此问题的其他人。

I found that, in Windows 10 at least, using the task manager to stop all git processes is enough to free up the files so they can be removed. Then simply restart git and you are good to go. No reboot required.

我发现,至少在 Windows 10 中,使用任务管理器停止所有 git 进程就足以释放文件,以便可以删除它们。然后只需重新启动 git 就可以了。无需重启。

回答by Stephen

This is what worked for me: I stopped the bash process in task manager. I then removed each file one by one until I could delete the whole folder.

这对我有用:我在任务管理器中停止了 bash 进程。然后我一个一个地删除每个文件,直到我可以删除整个文件夹。