How to systemwide ignore a specific file in all repositories

Although a list­ing in a .git­ig­nore file works most of the times, what if you want to always ignore the file but dont want to men­tion it in your .git­ig­nore file. For exam­ple, if you are are using the sftp plu­gin for sub­lime text, and dont want to explic­itly list sftp-config.json in your .git­ig­nore, you can do so by men­tion­ing it in a global git­ig­nore file that is not part of your repository.

1) Cre­ate a .git­ig­nore file any­where on your file sys­tem out­side of your project direc­tory.
2) Set it as the value of the core.excludesfile global property.

E.g. If I cre­ated my .git­ig­nore file in my home direc­tory, I could use the fol­low­ing command.

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

Ryan Sukale

Ryan is a UX engineer living in San Francisco, California.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *