Global Ignore

Chester Wyke September 10, 2022 Updated: April 15, 2025 #git

Foreword

Instructions written for linux (not tested on Windows)

Specify global ignore file

Open git config file

It’s ok if the file does not exist. You can just create it.

Note: It is unlikely that the file does not exist because mandatory settings like your name and email address go in the user section of that file.

nano ~/.gitconfig

Create or find core section

It starts with the text [core]. If section did not exist (or the file did not exist) then simply add that text.

Under that section add the following

excludesFile = ~/.gitignore_global

Final content (ignoring other settings) should look like

[core]
	excludesFile = ~/.gitignore_global

Add entries to file

Use the normal git ignore format. More info on that can be found here.

Add them to the file specified in the last step

nano ~/.gitignore_global