Amass

How to tell Git to ignore certain files

February 7th, 2008 Luke

I’ve spent the last week and a half or so working on setting up a Linux server to have around the house - I think that it will help for me to be able to do my developing on an internal box, and then just deploy it out to the world when the project is ready(I will have more ready soon, I hope - my portfolio is looking a little bit bare).

At any rate, I managed to get a server up and running, under Ubuntu 7 Server - and decided to embark down the muddled path that is source control.

A friend recommended Git, and so that is what I’ve installed(and am therefore using). But when you’re running on a Mac, OS X creates files called .DS_Store inside every directory - which are not what I want to have under version control. I only want the files I create to be under version control.

To that end, Git allows you to setup a list of patterns that it will use to ignore files with. That list is inside myrepo/.git/info/exclude. Here’s what mine looks like:

.DS_Store

And with that simple change, the .DS_Store file is automatically excluded(although I could still force it to be added using git add -f).