Git无法删除干净

时间:2012-04-08 17:27:45

标签: git repository

当我输入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
从命令

。然而,我需要删除这些文件以检查我的分支,因为我收到以下消息:

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

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

4 个答案:

答案 0 :(得分:8)

试试sudo git clean -f。您可能需要提升权利。

答案 1 :(得分:3)

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

手动删除它们
rm -f ._afs4FB8 ._afs6D97 ._afs865F ._afs9439 .__afsF9E

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

答案 2 :(得分:1)

  • 转到另一个(空)文件夹
  • 运行git init。
  • 结帐你的分行

答案 3 :(得分:0)

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

文件夹内的

chmod u+w .。然后git clean --force -d应该有效。