UtkarshPramodGupta
UtkarshPramodGupta

Reputation: 8152

.gitignore not ignoring the sub-directory .DS_Store files

I tried everypossible solution I found here but none working. This is my .gitignore file:

*.pyc
.DS_Store
static/.DS_Store

It ignores .DS_Store files in the root directory of my repo but doesn't in the subdirectories like the directory named static. I even tried to add the follwoing in the .gitidnore files but they also don't work:

*/.DS_Store
**/.DS_Store
*DS_Store

Upvotes: 1

Views: 2303

Answers (1)

Tim Biegeleisen
Tim Biegeleisen

Reputation: 520878

You need to remove the files in static/.DS_Store before the rules you have to .gitignore can take effect. Run this from the Git bash:

git rm -r --cached static/.DS_Store

This will delete these files from the repo, while retaining them on your local file system, which is what you want. After running this command, you should be able to see the delete changes by running git status.

Upvotes: 4

Related Questions