trejder
trejder

Reputation: 17513

Git reports untracked .gitignore file, that does not exist

How to resolve following situation:

$ 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

The .gitignore file under htdocs/files actually does not exist:

$ 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

(there are, however .gitignore files under each of listed folders, but I doubt, that this matters in this case)

I don't know, why git has any record about non-existing htdocs/files/.gitignore? How to resolve this?

Upvotes: 0

Views: 594

Answers (2)

Code-Apprentice
Code-Apprentice

Reputation: 83597

Since .gitignore starts with a period, bash considers it as a "hidden" file. This means that you need to use the -a option with ls in order to see it: ls -la. You can view the contents of the file with less .gitignore.

Upvotes: 4

filmnut
filmnut

Reputation: 756

Forget Git. Just bash it.

rm htdocs/files/.gitignore

Upvotes: 1

Related Questions