首页 > 解决方案 > 无法删除 git 中未跟踪的文件 - 文件显示没有这样的文件或目录

问题描述

嗨,我正在尝试在 Windows 10 上的 Ubuntu 上的 Bash 上删除 git 中的未跟踪文件。我能够推/拉没有问题。

我去的时候

git status

我得到以下信息:

Untracked files:
 (use "git add <file>..." to include in what will be committed)

    /Home/SignInButton.js

nothing added to commit but untracked files present (use "git add" to track)

如果我进入目录,我会得到

-rwxrwxrwx 1 root root  655 Jun  9 22:43 LogInButton.js
-????????? ? ?    ?       ?            ? SignInButton.js

我尝试了以下命令

git rm                No change
git checkout -- .     No change
git reset --hard      Reset but still the same warning
git clean -f -d       I get the "No such file or directory"
git stash             No change

我还应该尝试什么?

标签: git

解决方案


文件列表?中的数字表示 Linux 子系统试图清除资源,但子系统之外的东西却保留了它的情况。

一旦所有打开的文件句柄都关闭,无论是在 Linux 子系统内部还是外部,删除操作都应该完成。


推荐阅读