I recommend adding this .gitignore file as soon as you create a new Git repository:
Octocat’s .gitignore: Some common .gitignore configurations
As you might know, Git has a pretty complex ignore system, especially if you want to start ignoring files that are already in the repo. Adding this .gitignore file to your repo immediately after you create it might save you some headaches down the line.