Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.DS_Store still appears in git status despite being in .gitignore

Tags:

git

gitignore

$ cat .gitignore 

# OSX
*/.DS_Store
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
Icon?
ehthumbs.db
Thumbs.db

$ git status
On branch develop
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

    modified:   Assets/Sprites/.DS_Store

no changes added to commit (use "git add" and/or "git commit -a")

There are more unrelated files in .gitignore and status message right now, but .gitignore itself is not modified, this version is committed.

How can I fix that?

like image 415
Max Yankov Avatar asked Sep 06 '14 12:09

Max Yankov


People also ask

Should you add .DS_Store to Gitignore?

DS_Store file in your directories. It's not a big issue, but often you need to exclude these files explicitly in your . gitignore file, to prevent any unnecessary files in your commit. You may want to ignore this file globally, so next time you don't need to add it to your project's ignore list.


1 Answers

Make sure .DS_Store isn't in the cache:

git rm --cached -- Assets/Sprites/.DS_Store
like image 155
VonC Avatar answered Sep 21 '22 10:09

VonC