Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does Git report a random, non-existent directory or file as an untracked file?

Tags:

git

After making a few changes within a repo, when I run a git status I get the following:

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

   "etting\357\200\233\357\200\233\357\200\233\357\200\233\357\200\272"

This file does not exist. I'm not sure where the seemingly random numbers come from. Oddly, it's also surrounded in quotes. The status does also correctly show my modified files.

What could cause this? I've had it happen a few times before and had to perform a reset to return to a correct state. Is it possible the repo is corrupted in some way?

like image 681
Sio Avatar asked Oct 14 '16 16:10

Sio


People also ask

Why is a file untracked in git?

Untracked basically means that Git sees a file you didn't have in the previous snapshot (commit), and which hasn't yet been staged; Git won't start including it in your commit snapshots until you explicitly tell it to do so.

How do I change untracked files to track?

You have to add the untracked files of the repository by using the “git add” command and run the “git stash” command to save the untracked file and clean the current directory for working by removing the untracked file from the repository folder.


Video Answer


2 Answers

If you add an untracked file like ":q" it reports as "\357\200\272q" .

like image 156
strandmyr Avatar answered Sep 29 '22 23:09

strandmyr


You probably are committing a file you accidentally made called: "etting::::" or something similar. I had "c/357\200\272" because I accidentally made a file called 'c:' in that directory.

Just list what you have in that directory and you'll probably see the file that doesn't belong. Remove and you should be good.

like image 23
cheriejw Avatar answered Sep 30 '22 00:09

cheriejw