Create a global .gitignore
1touch ~/.gitignore_global
2git config --global core.excludesfile ~/.gitignore_global
foo/
will match a directory but not a file or symbolic linkfoo
without the /
is a glob pattern**/foo
will match a file or directory anywhereRemove files that are ignored now but are still in the Git repo
1git rm -r --cached node_modules
2git commit -m 'Remove the now ignored directory node_modules'
3git push origin master