【发布时间】:2018-11-14 09:18:06
【问题描述】:
我不知道这个问题是应该移到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 尝试过,但没有成功,它显示了there is no such file or directory!但文件始终存在!
所以我尝试了:
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
我的问题,这是什么意思?以及如何删除此文件?
【问题讨论】:
-
那个“奇怪”的空白一点也不奇怪。它是文件名的一部分。如果它是常规空格,那么每次将文件名(包括前导空格)放入命令行(任何命令行)时,您都可以将其包装成引号(
")或撇号(')。 F.e.git rm " file_x.php".