You can also create a global .gitignore file, which is a list of rules for ignoring files in every Git repository on your computer. For example, you might create the file at ~/.gitignore_global and add some rules to it.
# Declare the global .gitignore
git config --global core.excludesfile ~/.gitignore_global
# Create the .gitignore_global file
touch .gitignore_global