I'm frequently working in repositories I do not own (typically open source things). I often want to run dev containers in VS Code as part of my workflow. However, VS Code creates a .devcontainers/
directory for the configuration. For my own repos, this would be a good thing. I would like to have those config files checked into Git so I can track them and share them with other contributors. But for repos I do not own, it's not great. I'd much rather have them somewhere else, like in my home directory.
Is it possible to get VS Code to keep the .devcontainers/
directory outside of the repo I have opened in the dev container?
Luckily there's a super convenient solution: add .devcontainers/
to the .gitignore
file.
(If there isn't already a .gitignore file in the repo, you would need to create one.)