Mild Fuzz Mild Fuzz - 2 months ago 5
Git Question

Global Git ignore

I want to set up Git to globally ignore certain files.

I have added a

file to my user root directory (
) and I have added the following line to it:


But it is not ignoring this type of files, any idea what I am doing wrong?


You need to set up your global core.excludesfile configuration file to point to this global ignore file.



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

Windows git bash:

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

Windows cmd:

git config --global core.excludesfile "%USERPROFILE%\.gitignore"

For Windows it set to the location C:/users/{myusername}/.gitignore. The above command will only set the location of the ignore file that git will use. The file has to still be manually created in that location and populated with the ignore list.(from muruge's comment)

You can read about the command at