System-wide Git Global Ignores

If you are like me and love using a Mac for your development tasks, and want a way to get Git to ignore any file (like those pesky .ds_store’s) forever and for EVERY repository there is a very simple way to it.

Open Terminal and type:

git config --global core.excludesfile ~/.gitignore

and then:

echo .DS_Store >> ~/.gitignore

This will work for anything you want, just modify the second command as appropriate.  And you can run the second command as many times as you need.

Leave a Reply

Your email address will not be published. Required fields are marked *