What should I check in git config for a path that has been ignored until now?

Issue

.DS_Store files have been ignored for over 3 years

.DS_Store file has begun listing in "git status" as modified.

~/.gitignore_global has entry .DS_Store

.gitconfig has listing core.excludesfile=/Users//.gitignore_global

git check-ignore -v -n .DS_Store
output > :: .DS_Store

brew upgrade git

macOS 11.7 git 2.38.1

git user 8+ years

Solution

There is nothing wrong with your git config or gitignore.

Git’s gitignore rules affect only files that do not already exist in the index. Therefore, .DS_Store must be appearing in your git status because someone added and committed it, and you now have that commit (or a descendant commit) checked out.

So to make Git stop showing it in status, you need to remove it from the index. You can do that with git rm --cached ...

Answered By – matt

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published