linux - git status 显示不存在的未跟踪文件

标签 linux git shell

我不知道这个问题是应该移到 ServerFault 还是属于这里!

在远程 Unix 服务器上工作,我使用 FileZilla 创建了一个文件 file_x.php

我在终端上使用 GIT

当我执行 git status 时,它会向我显示:

On branch master
Untracked files:
  (use "git add <file>..." to include in what will be committed)
  some_other_file1.php
  some_other_file2.php
   file_x.php
  ^
  |__ Note this weird blank space

问题:我想删除这个文件,我从 FileZilla 尝试过,但这没有用,它告诉我没有这样的文件或者目录!但文件始终存在!

所以我尝试了:

rm -rf file_x.php       # This didn't work
sudo rm -rf  file_x.php # I'm not from the sudoers
git checkout file_x.php # This didn't do a thing !
git clear -f            # This didn't do a thing !
git rm file_x.php
==> fatal: pathspec 'file_x.php' did not match any files

我的问题是,这是什么意思?以及如何删除此文件?

最佳答案

你必须逃离空间:

rm \ file_x.php

关于linux - git status 显示不存在的未跟踪文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53296659/

相关文章:

linux - 如何从linux中的文件夹中一张一张地获取jpeg图像输入?

linux - 如何使用 rpmbuild 从主机上的源 RPM 为目标构建二进制 RPM

linux - 在步骤 CHDIR 生成 "/usr/bin/dotnet": No such file or directory 时失败

GIT - 如何在所有分支中保持文件通用

java - 使用 git 子模块管理 sbt 依赖

windows - 在 Windows 上的 Git Bash 中设置 Spark-shell

bash - Vim:打开文件后读取模式行?

bash - 如何只检测我的 bash shell 脚本中的不同文件?

Linux,忽略命令行上对 $variable 的引用。改用文字字符串

c++ - 在 C++ 中使用 ifstream 打开和关闭后,.txt 文件不再由 snmptrapd 守护进程写入