Erel Segal-Halevi
Erel Segal-Halevi

Reputation: 36753

How to prevent VSCode from opening all git repositories at startup?

Some of the folders in my VSCode workspace contain a large number of git repositories. Whenever I open VSCode, it spends a lot of time opening all these repositories. Usually I only need one or two of these repositories. I can close the unneeded repositories, but it takes a lot of time to open and then close them. Can I change the default behavior, such that no git repository is opened at startup?

Upvotes: 5

Views: 1211

Answers (2)

synthmusic
synthmusic

Reputation: 321

I found a good answer here that discusses these entries for settings.json

"git.autoRepositoryDetection": false or git.autoRepositoryDetection": "openEditors"

And after trying that out, I realized in my case I had a repo with submodules, so VSCode was following the information in the git repo. If someone tries the above setting with no luck, in your project root run

git submodule status

if you get back a list, you can tell VSCode to not open those with

"git.detectSubmodules": false,

For completeness: Presumably you only want the behavior in a specific workspace. To change workspace settings use command

Preferences: Open Workspace Settings (JSON)

as described here

Upvotes: 6

Alexey S. Larionov
Alexey S. Larionov

Reputation: 7927

Setting "git.ignoredRepositories": ["<repo_name>"] in the workspace settings JSON seems to help (the change is applied after restarting VSCode)

Upvotes: 1

Related Questions