How to ignore all hidden directories/files recursively in a git repository?

git, gitignore

Solution

Just add a pattern to `.gitignore`

.*
!/.gitignore

Edit: Added the `.gitignore` file itself (matters if it is not yet commited).

Problem

I'd like to have Git ignore all hidden files and directories. i.e. - `.aptitude` - `.ssh/` - `.bash_rc` - `config/.hidden` Is there a simple rule to cover this without specifically adding each entry?

Original source