Git报告未跟踪的.gitignore文件,该文件不存在

时间:2014-06-06 03:01:30

标签: git gitignore

如何解决以下情况:

$ git status
On branch master
Your branch is up-to-date with 'origin/master'.

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

        htdocs/files/.gitignore

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

$ git rm htdocs/files/.gitignore
fatal: pathspec 'htdocs/files/.gitignore' did not match any files

.gitignore实际下的htdocs/files文件不存在

$ cd htdocs/files/

$ ls -ls
total 0
   0 drwxr-xr-x    3 Trejder  Administ        0 Jun  2 23:53 audios
   0 drwxr-xr-x    3 Trejder  Administ        0 Jun  2 23:53 files
   0 drwxr-xr-x    3 Trejder  Administ        0 Jun  2 23:53 photos
   0 drwxr-xr-x    3 Trejder  Administ        0 Jun  2 23:53 videos

(但是,每个列出的文件夹下都有.gitignore个文件,但我怀疑,在这种情况下这很重要)

我不知道,为什么git有关于不存在htdocs/files/.gitignore的任何记录?如何解决这个问题?

2 个答案:

答案 0 :(得分:4)

由于.gitignore以句点开头,因此bash将其视为“隐藏”文件。这意味着您需要将-a选项与ls一起使用才能看到它:ls -la。您可以使用less .gitignore查看文件的内容。

答案 1 :(得分:1)

忘记Git。只是打击它。

rm htdocs/files/.gitignore
相关问题