.gitignore is for files/folders that you haven't checked in already. It's essentially a text file that you create in the repository and has a list of paths relative to the directory it was placed in, which Git will ignore. You can check-in the .gitignore file as part of the repository. you can find examples - at the end of this page
However if your file has already been checked in the repository then you can use:
git update-index --assume-unchanged file
which will tell Git to ignore any changes to that file made in the future. However this is a local configuration so you will have to do it on each machine you check out. You can revert it by doing:
git update-index --no-assume-unchanged file
Depending on what configuration that file contains it might be a good practice to have a skeleton/example config file in the repository - similar to what PHP guys do with config_example.php, which then is used by people to create config.php, which in turn never get's checked in the repository because it is ignored.
git update-index --assume-unchanged
worked for me (no hyphen aftergit
). Using git version 1.8.1.2 - OS X 10.8.2. Thanks! – Tyrannicide