Search code examples
gitignoregit-tower

Ignoring .DS_Store in a gitignore file using Tower


I have a new repo and before I perform the first commit I'd like to ignore .DS_Store files.

I've tried adding the following to the .gitignore file via Tower:

.DS_Store
*.DS_Store
*/.DS_Store

But only the .DS_Store file at the root is ignored, all others are included ready for commit.

Is there a trick to getting these files to be ignored?


Solution

  • Make sure you didn't add to the index those DS_Store first.

    If you did, check out "How Can I Remove .DS_Store Files From A Git Repository?", and then check if your .gitignore works.
    Use git rm --cached if you want just to remove then from the index while keeping them in the working tree.

    Note: only .DS_Store should be enough in your case.

    See Objective-C.gitignore from the GitHub Collection of Useful .gitignore Templates.