Skip to content

Instantly share code, notes, and snippets.

@NikhilMath
Created March 24, 2023 17:02
Show Gist options
  • Save NikhilMath/1667b53f578d5d2fc45363cc0e5c8d6f to your computer and use it in GitHub Desktop.
Save NikhilMath/1667b53f578d5d2fc45363cc0e5c8d6f to your computer and use it in GitHub Desktop.
How to Banish .DS_store in Your Repo on macOS

How to Banish .DS_store in Your Repo on macOS

Step 1 - (Skip to Step 2 if you don't have .DS_store currently in your repo)

Paste this into your terminal while you're in your directory to remove existing .DS_Store files from the repository:

find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch

Step 2

Add this line: .DS_store to the file .gitignore, which can be found at the top level of your repository (or create the file if it isn't there already). You can do this easily with this command in the top directory:


Congratulations, if you followed these steps, .DS_store should not be an issue for you anymore!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment