0

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.

phd
  • 82,685
  • 13
  • 120
  • 165
Alan2
  • 23,493
  • 79
  • 256
  • 450
  • Possible duplicate of [How to make Git "forget" about a file that was tracked but is now in .gitignore?](https://stackoverflow.com/questions/1274057/how-to-make-git-forget-about-a-file-that-was-tracked-but-is-now-in-gitignore) – phd Feb 19 '19 at 12:42
  • https://stackoverflow.com/search?q=%5Bgitignore%5D+forget+file – phd Feb 19 '19 at 12:42

1 Answers1

1

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.

Patrick
  • 1,728
  • 2
  • 17
  • 30
  • 1
    Correct. .gitignore will not ignore any files that are already tracked. Also, you can use `git rm --cached` to stage the removal but leave the working tree file, just in case it is something you'd rather keep. – John Szakmeister Feb 19 '19 at 10:28