Search code examples
gitgitignore

I cannot stop git from looking at my .DS_Store file


The first few lines of my .gitignore file looks like this:

## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore

.DS_Store

So I am confused as I keep seeing this message all the time:

'origin/master'.

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:   Test/.DS_Store

Untracked files:

It seems like the .gitignore entry is not being recognized.


Solution

  • Try removing the .DS_Store file like so:

    git rm .DS_Store
    

    It seems that the file was added once to the repository already, so removing it again might be necessary. From then on, it should be ignored as specified in the .gitignore file.