I have a global gitignore file defined in my gitconfig but Visual Studio Code seems to not be interpreting it. How would I use a global gitignore with Visual Studio Code?
I have a global gitignore file defined in my gitconfig but Visual Studio Code seems to not be interpreting it. How would I use a global gitignore with Visual Studio Code?
EDIT: Comment from Piyush Soni.
As of 9 august 2021, for this configuration to work, you also have to check useIgnoreFiles, hence:
"search.useGlobalIgnoreFiles": true,
"search.useIgnoreFiles": true
You have to add these in your settings to allow global gitignore:
"search.useGlobalIgnoreFiles": true
Found on Microsoft/vscode#59364.
For this to work, I also had to restart my VSCode session.
Note that you must already have a global ignore file if you want it to be useful. You can set or see which one is set with the next commands:
# get
git config --global core.excludesFile
# set
git config --global core.excludesFile <filename>
See more details about gitignore on the git documentation.
This steps to Windows:
Done! That’s it! Using .gitignore_global will let you customize your editor without having to edit and commit changes to the .gitignore file for every single project.
I know this thread is several months old but the correct answer for this, today, is to open settings in Code and search for "git" and then check the box "Use Global Ignore Files".
Of course, you can add it manually too, but no need for that now as it has been added in settings.
To ignore vscode globally you can use this in .gitignore file:
**/.vscode
This ignores vscode in all subdirectorys