How to add to a Git Ignore file

Have a .gitignore file in the root of your git repository, or in any sub folder under it, which will be inherited by every sub folder.