简体   繁体   中英

How can I ignore whole git repository in visual studio code?

It's not about using .gitignore to ignore certain files, it's about completely excluding that particular repository from file watcher of VScode.

It complains that there's more than 5000 files are opened and then just hanged my laptop. This repository has insane amount of files, and it's located in my home folder as my configs are stored in git, in .gitignore I've added all files to ignore, and when I need to stash the files I'm using git add -f <file> .

As you can see on the picture repository holms is always opened, and it's causing me issues, this is parent repo, which is in my home folder. How can I ignore it completely? if I close that repo, it appears again after like 3 minutes of working in a editor

在此处输入图像描述

Had the same problem, try adding option:

"git.autoRepositoryDetection": false

and close repo from your parent (home) folder. It shouldn't appear again.

Update:

There's now an option to watch only repositories for opened files: "git.autoRepositoryDetection": "openEditors"

This way, if you open any file in a specific repository, vscode will only watch it.

Another solution is to use the Ignored Repositories in settings, for example to ignore the repository in home directory you can add:

"git.ignoredRepositories": [
    "/home/holms"
],

Or from the settings editor (my username is obi)

在此处输入图像描述

You could also select which repositories to hide manually:

在此处输入图像描述

Open `source control repositories view在此处输入图像描述 And select the main repository you want. It won't be reset after restarting.

It's not about using .gitignore to ignore certain files, it's about completely excluding that particular repository from file watcher of VScode.

It complains that there's more than 5000 files are opened and then just hanged my laptop. This repository has insane amount of files, and it's located in my home folder as my configs are stored in git, in .gitignore I've added all files to ignore, and when I need to stash the files I'm using git add -f <file> .

As you can see on the picture repository holms is always opened, and it's causing me issues, this is parent repo, which is in my home folder. How can I ignore it completely? if I close that repo, it appears again after like 3 minutes of working in a editor

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM