How to fix .vscode tracking in gitignore

Maybe try this in your .gitignore. This should ignore the entire .vscode directory, no matter where it is located.

**/.vscode/

Happened for an Untracked git file .vscode/settings.json. Turned out to be a second line in our huge .gitignore file that was overriding the effort. In example below simply remove the bottom line.

Remember to re-stage and commit .gitgnore after the change.

# IDEs and editors
.settings/
.vscode/settings.json   -- Line I added that "was not working"
...

# IDE - VSCode
.vscode/*
!.vscode/settings.json  -- Line discovered that was overriding above (REMOVE)
...

Had similar problem, turned out the files were added to my cache. Clearing it with below command worked.

git rm --cached .vscode/settings.json

Reference to the issue on github where I found the solution.