How to disable git for some project and other project not disable git in Visual Studio Code?

13,963

Solution 1

You could add your git settings to the workspace settings.json file. That way, vscode would ignore git changes for only that project. Create or add to the .vscode/settings.json file.

"git.enabled": false

This way all of your other project will continue have git enabled.

Solution 2

To follow up with @alexriedl's answer, that snippet would be added into settings.json to apply for that workspace only:

{
    "git.enabled": false
}

Here's an example folder structure:

myproject/
├── .vscode/
│   ├── settings.json <----
├── html/
│   ├── index.html
│   └── 404.html
└── js/
    ├── bootstrap.js
    └── bootstrap.min.js

Solution 3

You could add * in your .gitignore file

#to ignore all project's file
*

Solution 4

A possible solution by simply using the VSCode UI:

  • right click on project name
  • click on "Open Folder Settings"
  • open "Extensions" then "Git"
  • scroll down until "Enabled - Whether git is enabled"
  • uncheck it
Share:
13,963

Related videos on Youtube

Mark Zhang
Author by

Mark Zhang

Updated on April 17, 2022

Comments

  • Mark Zhang
    Mark Zhang about 2 years

    some project i don't want use git monitoring , but in other project i want to keep use git monitoring , i use setting

    "git.enabled": false,
    "git.path": null,
    "git.autofetch": false
    

    but it will disable git for all project , so how to setting Visual Studio Code git for project instead of the editor?

  • iSaumya
    iSaumya almost 6 years
    Thank a lot for this answer. I have been looking for this everywhere
  • Elia Weiss
    Elia Weiss over 4 years
    I think the correct format is: { "git.enabled": false }
  • Sebastian Nowak
    Sebastian Nowak over 2 years
    And effectively disable git in that project completely, not just in VSC? Excellent idea.
  • zkoza
    zkoza over 2 years
    OP asked how to disable, not how to remove git support.
  • Waleed Khaled
    Waleed Khaled about 2 years
    Oh man , this was violent