Git enumerates nonexistent untracked files slowly Git enumerates nonexistent untracked files slowly git git

Git enumerates nonexistent untracked files slowly


First, I want to acknowledge Sven Marnach's comments above that basically gave me this solution.

Problem: I had this problem too, but my HD(s) is/are fine. It takes 3-5 seconds to do a "git status" on a SSD drive and 4-8 seconds on a magnetic one. It's a lot faster after I've done it a few times. I also see this error about taking so long to enumerate untracked files but I have no changes to commit.

Quick Solution: Delete whatever files are being hidden by your .gitignore files.

Better Solution: Stop building in the same directory that is in source control.

Why: Git still has to go through all the non-tracked files, see if there any new ones and then cross-reference them against the entries in .gitignore. This error is not saying that you have files that need to be checked in, rather that it's taking a really long time these days to figure out if there's a file that needs to be checked in.

On a clean checkout where there are no files to be hidden by git ignore and an SSD drive, running "git status" takes 0.8 seconds.

One last note: This is a really old project and we have a really large .gitignore file. I suspect that reducing 100 entries down to a single directory would help too, but unfortunately we have a few files in each of these output directories that are checked in.


My solution was to remove full file paths in .gitignore and ignore directories instead where possible.

Just to note my gitignore was 15000 lines long.


Just for clarifying the solution gave by the author in the latest comment:

I've replaced my drive and since not encountered this issue.

The problem was not in git itself but instead the problem was in the computer Hardware.
Once the HD was replaced - issue resolved.