GIT ignore globally a file

You might have files in multiple project (which are version controled) with the same name, or you use to create some general files.
Those you might sometimes accidently add them to the repo, so in order to avoid this do the follwoing:
– open a terminal and check which is your .gitignore global file “git config –get core.excludesfile”
– that will return something like this “~/.gitignore”
— IF nothing returned than do this >> “git config –global core.excludesfile ‘~/.gitignore'” for linux enviroment, and for Windows cmd >> git config –global core.excludesfile “%USERPROFILE%\.gitignore” — or create “~/.config/git/ignore”

– than using an editor modify the file “vim ~/.gitignore”
– file might look something like this

# Mac OS X

– at the end add your files like “*test.php” -> will ignore test.php from any git repo