How to systemwide ignore a specific file in all repositories

Although a listing in a .gitignore file works most of the times, what if you want to always ignore the file but dont want to mention it in your .gitignore file. For example, if you are are using the sftp plugin for sublime text, and dont want to explicitly list sftp-config.json in your .gitignore, you can do so by mentioning it in a global gitignore file that is not part of your repository.

1) Create a .gitignore file anywhere on your file system outside of your project directory.
2) Set it as the value of the core.excludesfile global property.

E.g. If I created my .gitignore file in my home directory, I could use the following command.

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

Ryan Sukale

Ryan is just a regular guy next door trying to manage his life and finances.

You may also like...

Leave a Reply

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