Git global recursive directory ignore

Many IDEs create per-project cache directories with metadata relevant to the IDE configuration for that project. Instead of editing the .gitignore file for each repository, ignore directories in Git system-wide for all repos as follows, for any operating system.

System-wide .gitignore

Tell Git where the global ~/.gitignore file is:

git config --global core.excludesfile ~/.gitignore

Create / edit the ~/.gitignore file to include things like:

.vs/
.vscode/
.idea/

.mypy_cache/
.DS_Store

*.pyc