Magento Open Source includes a base .gitignore file. See the latest Commerce .gitignore file. If you must add a file that is in the .gitignore list, you can use the -f (force) option when staging a commit:
.gitignore
-f
git add <path/filename> -f