Ignore .DS_Store
Keep macOS folder metadata out of your project.
Repository-level rule
Add this line to the project .gitignore. A name pattern without a slash can match at any directory level. This is a suggested rule based on Git ignore semantics.
.DS_StoreCheck whether it is already tracked
Use git ls-files to inspect tracked names. If it is tracked, an ignore rule alone is not enough. Review the exact paths before removing them from the index.
git ls-files
git check-ignore -v --no-index .DS_StoreLocal-only preferences
A repository .gitignore is shared. .git/info/exclude is local to that repository. A configured core.excludesFile can apply personal ignore rules across repositories. Pick the audience intentionally.
Do not use a broad destructive cleanup
Deleting every hidden file or running git clean with force is not needed to ignore .DS_Store. Hidden files can include important configuration and secrets.
Quick check
Which ignore file is normally shared through commits?
Choose an answer.
Sources and scope
Command blocks are syntax examples checked against official documentation, not fabricated terminal output. Replace uppercase placeholders with your actual names and inspect status before commands that change work.