git Git无法使用干净删除

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10064801/
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 06:43:51  来源:igfitidea点击:

Git Failing to remove with clean

gitrepository

提问by Layla

when I type in git clean -fi get the following error message:

当我输入时,git clean -f我收到以下错误消息:

>     Removing .__afs043
>     warning: failed to remove .__afs043
>     Removing .__afs0F7D
>     warning: failed to remove .__afs0F7D
>     Removing .__afs1359
>     warning: failed to remove .__afs1359
>     Removing .__afs1421
>     warning: failed to remove .__afs1421
>     Removing .__afs243A
>     warning: failed to remove .__afs243A
>     Removing .__afs2745
>     warning: failed to remove .__afs2745
>     Removing .__afs3454
>     warning: failed to remove .__afs3454
>     Removing .__afs3D12
>     warning: failed to remove .__afs3D12
>     Removing .__afs4A5E
>     warning: failed to remove .__afs4A5E
>     Removing .__afs4FB8
>     warning: failed to remove .__afs4FB8
>     Removing .__afs5D5B
>     warning: failed to remove .__afs5D5B
>     Removing .__afs5E1D
>     warning: failed to remove .__afs5E1D
>     Removing .__afs6086
>     warning: failed to remove .__afs6086
>     Removing .__afs6328
>     warning: failed to remove .__afs6328
>     Removing .__afs6D97
>     warning: failed to remove .__afs6D97
>     Removing .__afs7562
>     warning: failed to remove .__afs7562
>     Removing .__afs7C22
>     warning: failed to remove .__afs7C22
>     Removing .__afs8148
>     warning: failed to remove .__afs8148
>     Removing .__afs865F
>     warning: failed to remove .__afs865F
>     Removing .__afs8CE5
>     warning: failed to remove .__afs8CE5
>     Removing .__afs9295
>     warning: failed to remove .__afs9295
>     Removing .__afs938C
>     warning: failed to remove .__afs938C
>     Removing .__afs9439
>     warning: failed to remove .__afs9439
>     Removing .__afsA5EC
>     warning: failed to remove .__afsA5EC
>     Removing .__afsA859
>     warning: failed to remove .__afsA859
>     Removing .__afsB044
>     warning: failed to remove .__afsB044
>     Removing .__afsB9EF
>     warning: failed to remove .__afsB9EF
>     Removing .__afsC47E
>     warning: failed to remove .__afsC47E
>     Removing .__afsCF6E
>     warning: failed to remove .__afsCF6E
>     Removing .__afsD42
>     warning: failed to remove .__afsD42
>     Removing .__afsD50F
>     warning: failed to remove .__afsD50F
>     Removing .__afsE6B9
>     warning: failed to remove .__afsE6B9
>     Removing .__afsE9F3
>     warning: failed to remove .__afsE9F3
>     Removing .__afsF0DA
>     warning: failed to remove .__afsF0DA
>     Removing .__afsF9EA
>     warning: failed to remove .__afsF9EA

from the command. Yet i need to remove these files in order to checkout of my branch because I get the following message:

从命令。但是我需要删除这些文件才能结帐我的分支,因为我收到以下消息:

Error: The following untracked working tree files would be overwritten
by checkout:
          .__afs4FB8
          .__afs6D97
          .__afs865F
          .__afs9439
          .__afsF9EA Please move or remove them before you can switch branches. 

Aborting

What do I do??! I need to be able to checkout and update this branch fast!

我该怎么办??!我需要能够快速结账和更新这个分支!

回答by Qwerty

Try sudo git clean -f. You probably need elevated rights.

试试sudo git clean -f。您可能需要更高的权限。

回答by krzysz00

Since git cleanis refusing to remove these untracked files, try removing them manually by doing

由于git clean拒绝删除这些未跟踪的文件,请尝试通过执行手动删除它们

rm -f ._afs4FB8 ._afs6D97 ._afs865F ._afs9439 .__afsF9E

This should either remove the files or give you a more helpful error message.

这应该删除文件或为您提供更有用的错误消息。

回答by rainecc

  • go to another (empty) folder
  • run git init .
  • checkout your branch there
  • 转到另一个(空)文件夹
  • 运行 git init 。
  • 在那里结帐你的分行

回答by Elijah Lynn

You need to check permissions on the files AND the containing folder. If the files have write permission then the folder most likely does not.

您需要检查文件和包含文件夹的权限。如果文件具有写入权限,则该文件夹很可能没有。

chmod u+w .while inside the folder. Then git clean --force -dshould work.

chmod u+w .而在文件夹内。然后git clean --force -d应该工作。