RSS Amplifier

Duy NG · Jan 14, 2025

[Note] Ingore all .DS_store files globally

0
Sign in to vote or save

This page cannot be shown here. You can still read it on the original site — the toolbar below keeps your place in the directory.

Backend Engineer · Open source · Terminal

Ignore all .DS_Store files globally

If you use Git on a Mac, you’ve probably accidentally committed a .DS_Store file to a repo at least once. I used to add .DS_Store to every .gitignore file to avoid this, but there’s a better way!

You can create a global .gitignore file that applies to all your repositories. Just run this command:

git config --global core.excludesFile '~/.gitignore'

Then, add .DS_Store to your ~/.gitignore file:

echo ".DS_Store" >> ~/.gitignore

This command adds the following to your ~/.gitconfig:

[core]
    excludesFile = ~/.gitignore

Now, .DS_Store files will be ignored across all your projects, no more accidental commits!

You can directly edit the ~/.gitignore file to globally ignore many other files.

Read on /notes/gitignore-globally/

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.