Visual Studio Code reports "It look like git is not installed on your system." when I try to switch to the git view. I know I have git installed and used by other Git clients. I guess if I reinstall Git following Visual Studio Code's instruction ("install it with Chocolatey or download it from git-scm.com"), it probably can fix the problem, but I don't want to mess up the existing Git clients on my system. Is there a reliable way to configure Visual Studio Code so it can find existing git installation?
-
Did you do an actual Git for Windows installation, or did you use Portable Git? Is `git` in your `PATH`? – Edward Thomson Apr 30 '15 at 16:05
-
1@EdwardThomson I don't think I actually installed Git for Windows and that is exactly my problem. I didn't have git in PATH. I have various git's: GiHub client, SourceTree, Eclipse plugin, even cygwin. I added cygwin path to PATH just for the reason of curiosity and VS Code found it! Thanks for hint! Installing Git for Windows probably is still the right thing to do. (Now I need to figure out how to set the workspace properly so VS Code will not complain "This workspace isn't yet under git source control" but that will be a different question.) – zhouji Apr 30 '15 at 16:49
-
Cool, I'll add this as an answer. – Edward Thomson Apr 30 '15 at 17:02
-
I saw the same error mentioned in the previous comment ("This workspace isn't yet under git source control") both for existing git repository directory and new one created by VS Code. After I installed a 'real' Git for Windows, the problem disappeared. Hopefully this experience is useful for other new VS Code users. – zhouji Apr 30 '15 at 19:36
-
4I have this problem, ONLY when running VS Code "as administrator", the `git.path` is not overridden in my normal user (non-admin) VS Code, but seems to find git just fine over there. Overriding `git.path` while in administrator mode (and then restarting VS Code) did not seem to help. My error: `Git not found. Install it or configure it using the git.path setting.` – bkwdesign Oct 05 '18 at 14:35
-
UPDATE: I finally figured out that there's a system PATH variable, and then USER-specific PATH variables, and the Git was only in 1 of my user-specific PATHs – bkwdesign Oct 05 '18 at 14:45
-
None of the work-arounds works for me. It's 2019, very surprising a work-around would be needed in the first place. I've uninstalled/reinstalled VS code a couple of times as well. Details: Windows 10 64-bit, latest version of Git installed on my system and find-able in PATH. One observation: git.path does not exist, though git.defaultCloneDirectory does, and the settings/search eludes to it (pointing this to git.exe does not work either). Is MS mixing up parameters? – Yost777 Apr 02 '19 at 09:33
-
See also https://stackoverflow.com/questions/46609255/git-missing-in-vs-code-no-source-control-providers – Yost777 Apr 02 '19 at 09:39
-
Possible duplicate of [How do I use Bash on Windows from the Visual Studio Code integrated terminal?](https://stackoverflow.com/questions/42606837/how-do-i-use-bash-on-windows-from-the-visual-studio-code-integrated-terminal) – Matej J Jun 03 '19 at 16:02
-
@MatejJ completely different question. this question has nothing to do with using terminals – zhouji Jun 04 '19 at 21:36
-
If you're using HomeBrew, I simply changed the `git.path` in my VSCode settings to `"/usr/local/Cellar/git/"` – Ryan Walker Mar 17 '21 at 17:30
-
for vscode 1.60.1, this answer here did the trick for me https://stackoverflow.com/a/69161206/3270433 – FerdousTheWebCoder Sep 27 '21 at 07:23
-
@bkwdesign I have just the opposite situation: it works only when I run Vs code as admin(solved in shortcut settings) – mrapi Jul 20 '22 at 06:57
-
Related: *[Error "'git' is not recognized as an internal or external command"](https://stackoverflow.com/questions/4492979/errror-git-is-not-recognized-as-an-internal-or-external-command)* – Peter Mortensen Dec 17 '22 at 02:07
38 Answers
Now you can configure Visual Studio Code (version 0.10.2, check for older versions) to use an existing Git installation.
Just add the path to the Git executable in your Visual Studio Code settings (menu File → Preferences → Settings) like this:
{
// Is Git enabled
"git.enabled": true,
// Path to the Git executable
"git.path": "C:\\path\\to\\git.exe"
// Other settings
}

- 30,738
- 21
- 105
- 131

- 3,246
- 3
- 17
- 20
-
This worked great for me. Easier than digging around/setting path too (for me). Thanks. – Igor Apr 20 '16 at 18:28
-
2Make sure you install a version of git that understands Windows paths though. The one from MSYS2's pacman repo doesn't work for example. – qwertzguy Apr 25 '16 at 09:58
-
17
-
2newbs like me, your settings are here: file -> preferences -> settings – ss ulrey Dec 15 '17 at 21:30
-
1it works for me after adding this path "git.path":"C:\\Program Files\\GitWP\\bin\\git.exe" – Surendranath Sonawane Oct 22 '21 at 10:08
-
Note that "git.exe" must be included, so its not just the path but also the filename too. Only including the path is not enough. – icodeplenty Mar 02 '22 at 17:06
-
-
Use `CTRL + Shift + P` and `Open Settings (JSON)` if only the UI option appears. https://stackoverflow.com/questions/65908987/how-can-i-open-visual-studio-codes-settings-json-file#65909052 – SharpC Jul 22 '22 at 12:15
-
@neves is correct, the restart must be the complete application not just "Reload Window". For me I just needed to update the `git.path` setting with my bin folder location of git and full restart. – Ali Oct 10 '22 at 05:14
-
File is located here: ---**Windows:** %APPDATA%\Code\User\settings.json ---**macOS:** $HOME/Library/Application\ Support/Code/User/settings.json ---**Linux:** $HOME/.config/Code/User/settings.json – javipipero Oct 21 '22 at 10:24
-
PATH of git : for me I install git for windows and then find git.exe inside the installation path. and add git.exe path. – jitvimol Jan 18 '23 at 08:31
Update 2020 (Mac)
I went through this $h!†
again after updating to macOS v10.15 (Catalina), which requires an Xcode update.
And to clarify, while this post is about Visual Studio Code, this issue, is system wide. Your Git install is affected/hosed. You can try to run git
in your terminal, Bash, Z shell (zsh
), or whatever. It is now and it just won't.
It is the same fix. Just update Xcode. Start it up and agree to the license. That's it.
I hit this on Mac/OS X.
Symptoms:
- You've been using Visual Studio Code for some time and have don’t have any issues with Git
- You install Xcode (for whatever reason - OS update, etc.)
- After installing Xcode, Visual Studio Code suddenly "can't find Git and asks you to either install or set the Path in settings"
Quick fix:
Run Xcode (for the first time, after installing) and agree to license. That's it.
How I stumbled upon this "fix":
After going through numerous tips about checking git
, e.g., which git
and git --version
, the latter actually offered clues with this Terminal message:
Agreeing to the Xcode/iOS license requires admin privileges, please run “sudo xcodebuild -license” and then retry this command.
As to why Xcode would even wrap it's hands on git
, WAT.

- 30,738
- 21
- 105
- 131

- 11,753
- 6
- 42
- 83
-
11
-
5This solution did not work for me, but running the following did: `xcode-select --install` [[source](https://ma.ttias.be/mac-os-xcrun-error-invalid-active-developer-path-missing-xcrun/)] – Morgan Jan 19 '21 at 16:51
-
4With BigSur 11.2 running `xcode-select --install` does not work. With every MacOS update I've found I needed to reinstall the Command Line Tools regardless even if Xcode was up to date. Download from Apple – https://developer.apple.com/download/more/?=xcode – scottrod Feb 01 '21 at 23:32
-
1
-
4I stumbled on this too when I upgraded to Monterey. I had to do the `xcode-select --install` and then do a `brew upgrade`. – blackcatweb Oct 27 '21 at 15:31
-
1Lol, this was my exact use case, and the "fix" worked perfectly. Thank you! – Matthew Snyder Jun 04 '22 at 20:10
-
1
-
1Thank you so much! I don't understand why this keep happening! But I followed your instructions and they did the trick – yngrdyn Oct 04 '22 at 20:35
-
1yup, works after upgrading to Monterey. I found out that I haven't even installed xcode previously and vscode and git have no issues until the OS upgrade. – wi3o Oct 05 '22 at 00:25
-
1Had this issue to on Mac with new Monterey. VS Code was not registering git. The terminal did though. After I installed xcode, ran it, and restarted code. Git registered just fine. – Centerwork Oct 25 '22 at 16:41
-
On Ventura 13.1 I had the same issue, ran `xcode-select --install` from terminal, waited a few minutes, restart VSCode and all's good! – magicrebirth Jan 05 '23 at 20:41
-
1The same thing happened after updating to Ventura 13.2. After wasting around an hour going through many other StackOverflow threads finally, this worked! – Stefan Francis Jan 31 '23 at 07:05
-
Visual Studio Code simply looks in your PATH
for git
. Many UI clients ship with a "Portable Git" for simplicity, and do not add git
to the path.
If you add your existing git client to your PATH
(so that it can find git.exe
), Visual Studio Code should enable Git source control management.

- 74,857
- 14
- 158
- 187
-
30If you update your git-path in your user settings within visual studio code from `null` to `"F:\\Program Files\\Git\\mingw64\\libexec\\git-core\\git.exe"` (or something similar) you should simply have to restart VSCode and git will open successfully. My only addition is that if you do not use the git.exe within the directory `mingw64\libexec\git-core\git.exe` VSCode will open with various errors and bash terminals. – Eric Feb 01 '17 at 00:09
-
(more than 2 years later) for my case it's the other way other (VS Code version 1.14.2) and I'm quite curious. I don't have git in `PATH` however I have GitHub for Windows and Source Tree. Each of them has their own git.exe version shipped with the main program. I don't know how VS Code knew which git to choose, e.g. now the default git it will use is `git 2.11.0.windows.3` from GitHub found somewhere in `%APPDATA%` (?). Besides, in `settings.jsons` there's an option to specify the location of git.exe but I can't change to another git path use by Source Tree (just for testing purpose) – Jim Raynor Aug 05 '17 at 23:53
-
1@Eric, Adding { "git-path":"d:\\Program Files\\Git\\bin\\gite.exe" } didn't work, vscode still search in c:\... – user1767316 Feb 03 '18 at 11:41
-
5@Eric, but OK, git.path did the job: "git.path":"d:\\Program Files\\Git\\bin\\git.exe" ;-) – user1767316 Feb 03 '18 at 11:47
-
3This worked for me, although I had to reboot my machine (windows 10) which I didn't think I need to. Anyway, whatever works. – henrykodev Mar 08 '19 at 10:50
-
1git.path does not exist - where would this need to be added exactly? (OS: Windows 10 64-bit) – Yost777 Apr 02 '19 at 09:45
-
-
-
Windows cmd? `echo %PATH%`. Windows PowerShell? `echo $env:PATH`. bash? `echo $PATH` – Edward Thomson Apr 27 '20 at 21:54
-
-
I've searched to identify how to solve this and my resolution was to update on the settings the settings.json the git.path file. Changed the value from "" to "git.path": "C:/Program Files/Git"; My instalation was directly on Program Files and not in the app – Cortesao May 13 '21 at 17:22
-
I use `vscode` on windows in 2 ways: native and via wsl-remote. Native it works, but in `wsl-remote` it does not. I tried `"git.path":"/mnt/c/Program Files/Git/cmd/git.exe"` in `settings.json` - same settings for both -, it does not change anything and in `wsl` the letters of the setting entry are faint whereas in windows, they are normal. Obvously, it is not taken in windows because otherwise it would not work as windows has `c:` and not `/mnt..` – Timo Jun 21 '21 at 18:37
I had this problem after upgrading to macOS v10.15 (Catalina).
The issue is resolved as follows:
1.
Find the Git location from the terminal:
which git
2.
Add the location of Git in settings file with your location:
"git.path": "/usr/local/bin/git",
Depending on your platform, the user settings file (settings.json) is located here:
Windows
%APPDATA%\Code\User\settings.json
macOS
$HOME/Library/Application Support/Code/User/settings.json
Linux
$HOME/.config/Code/User/settings.json

- 30,738
- 21
- 105
- 131

- 2,324
- 1
- 21
- 24
-
5The same error happened when I updated macOS to Ventura 13. And this solution fixed my problem. – Zac Nov 14 '22 at 03:22
-
Hi @Zac I also using same laptop but I could not fix this issue, I did not understand the last step where do I want add the line - $HOME/Library/Application Support/Code/User/settings.json guid me please – Bhary Feb 07 '23 at 17:28
-
@BharathMb, you don't need to add this file manually. In vscode, open user setting (JSON). And it shows you the file. – Zac Feb 08 '23 at 05:00
This can happen after upgrading macOS. Try running Git from a terminal and see if the error message begins with:
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools) ...
If so, the fix is to run:
xcode-select --install
from the terminal. See this answer for more details.

- 30,738
- 21
- 105
- 131

- 779
- 6
- 7
In Visual Studio Code, open 'User Settings': Ctrl + P and type >sett. Press Enter.
This will open the default settings on the left side and User Settings on the right side.
Just add the path to git.exe in user settings:
"git.path": "C:\\Users\\[WINDOWS_USER]\\AppData\\Local\\Programs\\Git\\bin\\git.exe"
Replace [WINDOWS_USER] with your user name.
Restart Visual Studio Code.

- 30,738
- 21
- 105
- 131

- 411
- 4
- 3
-
-
@Bartosh Is it better to add the setting to the user.settings file rather than updating the default.settings? – gerard Dec 20 '17 at 12:26
-
"`>user`" is more specific than "`>sett`" (Visual Studio Code 1.74.3). – Peter Mortensen Jan 16 '23 at 00:53
First check if Git* is installed or not in your system by typing the command in cmd /command prompt (in Windows):
where git
If you get an output like this,
λ where git
C:\cmder\vendor\git-for-windows\cmd\git.exe
Then Go to Settings → Preferences → Settings and put the bellow code** right part.
{
// If git enabled?
"git.enabled": true,
// Path to the Git executable
"git.path": "C:\\cmder\\vendor\\git-for-windows\\cmd\\git.exe"
}
- If you don't have Git installed, install Git from https://git-scm.com/
** Just add a double slash (\\
), just like the above code.

- 30,738
- 21
- 105
- 131

- 930
- 2
- 12
- 22
-
1File > Preferences > Settings > User Settings > Extensions > Git > Path > Edit in settings.json (_if the displayed path isn't correct_) – datalifenyc Feb 10 '20 at 18:34
Upgrade to macOS v13 (Ventura) < 13.0
As of November 2022
Upgrading to macOS v13 (Ventura) does not seem to affect your coding environments too much.
After upgrading to macOS v13, your Terminal and Visual Studio Code will give off a few errors. Such as:
It looks like Git is not installed on your system ..
or
can't find Git and asks you to either install or set the Path in settings
Some errors depend on your Z shell (zsh
) setup or other customizations.
These common problems can be resolved by simply by reinstalling the Xcode command-line tools and updating Homebrew - since your terminal might be affected, reinstall from Apple's executable https://developer.apple.com/download/all/ developer.apple.com. You will need to log in with your Apple ID.
Once installed, update Homebrew:
brew upgrade
Mac M1 - M2 machines likely have some native and ARM applications, so run:
arch -arm64 brew upgrade
Close all terminals and Visual Studio Code to restart!
Reopen Visual Studio Code, and the errors should be gone.
If Visual Studio Code is still looking for the Git path, you will need to add it manually.
Find the Git location and copy from the terminal:
which git
And add the path to the Git executable in your Visual Studio Code JSON settings file (menu File → Preferences → Settings) find and update the line. It should look similar to:
"git.path": "/usr/local/bin/git",

- 30,738
- 21
- 105
- 131

- 111
- 1
- 5
-
Downloading xcode command line tools & brew upgrade fixed my issues. Very appreciated, can't thank you enough for this post! – Twissted Nov 16 '22 at 13:57
After an OS X update, I had to run xcode-select --install
for GitLens to work.

- 30,738
- 21
- 105
- 131

- 81
- 1
- 2
-
1This worked for me on OS X 10.14 (Mojave). I had already installed xcode from the app store, but never installed the command line tools. – joeyquarters Dec 24 '18 at 17:50
I ran into the same problem after!
How did I fix it?
Step 1: Go to the Settings in Visual Studio Code.
Step 2: Open settings.json.
Step 3: You need to find something like "git.path" in settings.json
Step 4: just add the directory path where Git is installed in your system.
Example: "git.path": "D:/Git/bin/git.exe"
Step 5: Restart your Visual Studio Code.

- 30,738
- 21
- 105
- 131

- 1,133
- 8
- 10
Run xcode-select --install
. It'll prompt you to install command line developer tools. Install the tools and restart your Visual Studio Code.
You'll see Git working once again in Visual Studio Code.

- 30,738
- 21
- 105
- 131

- 269
- 4
- 14
I ran into this problem after upgrading my macOS to macOS v12 (Monterey).
It turned out that Xcode has been removed in the new update from my mac. I Just tried the following suggested solution:

- 30,738
- 21
- 105
- 131

- 648
- 9
- 18
Visual Studio Code 1.50 (Sept 2020) adds an interesting alternative with issue 85734:
Support multiple values for the
git.path
settingI use VSCode in three different places; my home computer, my work computer, and as a portable version I carry on a drive when I need to use a machine that doesn't have it.
I use an extension to keep my settings synced up between editors, and the only issue I've encountered so far is that the git path doesn't match between any of them.
- On my home machine I have it installed to
C
of course,- work likes to be funny and install it on
A
,- and for the one on my drive I have a relative path set so that no matter what letter my drive gets, that VSCode can always find
git
.I already attempted to use an array myself just to see if it'd work:
"git.path": ["C:\\Program Files\\Git\\bin\\git.exe", "A:\\Git\\bin\\git.exe", "..\\..\\Git\\bin\\git.exe"],
But VSCode reads it as one entire value.
What I'd like is for it to recognize it as an array and then try each path in order until it finds Git or runs out of paths.
This is addressed with PR 85954 and commit c334da1.
"git.enabled": true
git.path

- 30,738
- 21
- 105
- 131

- 1,262,500
- 529
- 4,410
- 5,250
macOS - Visual Studio Code.
Step 1: Go to Visual Studio Code, menu File → Preferences → Settings (or Ctrl + ,).
Step 2: Type 'Path' in the search bar. You will get a result list that contains Git.
Step 3: Click on Git. After that, click on Edit in settings JSON file.
Step 4: In your Mac Terminal, type which git. You will get the Git path
Step 5: Just copy that path and add again the path key in the JSON file.

- 30,738
- 21
- 105
- 131

- 1,321
- 1
- 15
- 24
-
There are too many hits for "Path" in `Ctrl` + `,`. Can you [make](https://stackoverflow.com/posts/75855673/edit) it more specific to get the number of hits to a more manageable level? (But *** *** *** *** *** *** *** *** *** *** *** *** ***without*** *** *** *** *** *** *** *** *** *** *** *** *** "Edit:", "Update:", or similar - the answer should appear as if it was written today). – Peter Mortensen Apr 25 '23 at 14:33
I faced this problem on macOS v10.13.5 (High Sierra) after upgrading Xcode.
When I run the git
command, I received the below message:
Agreeing to the Xcode/iOS license requires admin privileges, please run “sudo xcodebuild -license” and then retry this command.
After running the sudo xcodebuild -license
command, the below message appears:
You have not agreed to the Xcode license agreements. You must agree to both license agreements below in order to use Xcode.
Hit the Enter key to view the license agreements at '/Applications/Xcode.app/Contents/Resources/English.lproj/License.rtf'
Typing the Enter key to open the license agreements and typing the space key to review details of it, until the below message appears:
By typing 'agree' you are agreeing to the terms of the software license agreements. Type 'print' to print them or anything else to cancel, [agree, print, cancel]
The final step is simply typing agree
to sign with the license agreement.
After typing the git
command, we can check that Visual Studio Code detected Git again.

- 30,738
- 21
- 105
- 131

- 37,383
- 15
- 83
- 73
If you have multiple environments. You could include Git Path in the Visual Studio Code Workspace Setting. For Windows, depending on your setting, you could hit Ctrl + P, search for "settings". Open settings.json (or menu File → Preferences → Settings). Navigate to Workspace Settings. Find "Path" and add paths to Git bin and cmd folders.
Environments can have their own paths. I discovered this when I echoed my PC %PATH% on cmd. Git bin and cmd path where available, but when I was working on my project, echoed %PATH% did not have git and cmd folder. Adding them, as shown above, solved the issue.
Extra Notes:
On cmd, you can echo "%PATH%" and see if git bin and cmd folders are included. If not, you could concatenate using SETX
PATH on, for example,
SETX PATH "%PATH%;Path_to_Git_bin;Path_to_Gt_cmd;"
This will make git available on local, root but not in some environments which comes with their own paths (SETX /M PATH "%PATH%;Path_to_Git_bin;Path_to_Gt_cmd;"
would have though).
In case you have a long Path that is chopped off due to Path length (getting "Error: Truncated at X characters." message), you can increase the path length in RegEdit.
- In "Search Windows", search for "regedit". Right-click to open as Administrator.
- Go to Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem
- Right-click and modify. Change value data from 0 to 1
This will increase your path length. If it is already one, then I am not sure how to proceed from there :).
[9

- 30,738
- 21
- 105
- 131

- 14,191
- 4
- 51
- 57
I have recently started with Visual Studio Code. I have this issue and just writing the exact path of the Git executable solves the issue. Here is the code:
"git.path": "C:\Program Files\Git\bin\git.exe",

- 30,738
- 21
- 105
- 131

- 1,085
- 8
- 8
-
4For me worked only with double backslashes: "git.path": "C:\\Data\\App\\Git\\bin\\git.exe" – Seweryn Habdank-Wojewódzki May 11 '18 at 13:53
The only way I could get to work in my Windows 8.1 is the following:
Add to system environment variables (not user variables):
C:\Users\USERNAME\AppData\Local\GitHub\PortableGit_YOURVERSION\bin;C:\Users\USERNAME\AppData\Local\GitHub\PortableGit_YOURVERSION\libexec\git-core;C:\Users\USERNAME\AppData\Local\GitHub\PortableGit_YOURVERSION\cmd\
This fixed the "it looks like Git is not installed on your system" error on my Visual Studio Code.

- 30,738
- 21
- 105
- 131

- 80
- 3
Three years later, I ran into the same issue. Setting the path in user settings & PATH environment variable didn't help. I updated Visual Studio Code and that solved it.

- 30,738
- 21
- 105
- 131

- 650
- 1
- 11
- 28
First install Git onto your desktop, and then add the encircled extension in Visual Studio Code, as seen in the picture.
That helped me fix the same issue you have.

- 30,738
- 21
- 105
- 131

- 23
- 4
Open
C:\Users\nassim\AppData\Roaming\Code\User\settings.json
Comment any Git line there:
// ...
// "git-graph.integratedTerminalShell": "E:\\Apps\\Git\\bin\\bash.exe",
// "git.path": ""
//...
And add git.exe to the OS path.
Note for me: Fixing this Git error also fixed the npm error too. Since they are both defined in the path, if one fail, the remaining will fail as well.

- 30,738
- 21
- 105
- 131

- 2,879
- 2
- 37
- 39
- Make sure Git is enabled (menu File → Preferences → Git Enabled) as other have mentioned.
- Make sure Git is installed and in the PATH (with the correct location, by default: C:\Program Files\Git\cmd) - PATH in System Variables, BTW
- Change the default terminal. PowerShell can be a bit funny, and I recommend Git Bash, but cmd is fine. This can be done by selecting the terminal dropdown and selecting 'set default shell' and then creating a new terminal with the + button.
- Restart Visual Studio Code, and sometimes reboot if that fails.

- 30,738
- 21
- 105
- 131

- 45
- 8
-
You are the first person that mentioned "reboot" -- this is important because windows system PATH changes do not take effect until you restart the machine, not even logging out appeared to do it for me though I verified in advanced settings on the machine, in the environment variables area that it was definitely there. – Mike Hardy Nov 18 '21 at 17:11
In my case, Git was installed on my Windows 10 OS and there was an entry in PATH variable. But Visual Studio Code 1.52.1 still is unable to detect it from a terminal window, but it was available in a CMD console.
The problem was solved by switching the terminal from PowerShell to CMD or shell, and a Visual Studio Code restart.

- 30,738
- 21
- 105
- 131

- 8,309
- 2
- 38
- 46
I solved the same problem on macOS with an M1 Pro processor by installing the GitLens Visual Code extension. The changed files were displayed after enabling the extension. Then I turned to reloading Visual Studio Code and there were no changes, but once I ran
git status
in the terminal, it showed all the files, and all changes were tracked.

- 30,738
- 21
- 105
- 131

- 1,336
- 1
- 14
- 33
I faced this issue after updating macOS!
I installed Git again using Homebrew, and it worked!
brew install git

- 30,738
- 21
- 105
- 131

- 1,559
- 19
- 24
For Mac
First, type
git
in the terminal and see what error you are getting.
Then:
If the error is related to a command line tool!
Run:
xcode-select --install
And
Just go ahead and go through this answer. For Mac especially. It worked very easily for me:

- 30,738
- 21
- 105
- 131

- 121
- 10
I found that I had git: false in settings.json and changed it to true. It works now.

- 30,738
- 21
- 105
- 131

- 353
- 1
- 4
- 5
Here's what worked for me. Instead of using the Visual Studio Code terminal to run your Git commands, run the Git commands from a cmd terminal at the path of your application.

- 30,738
- 21
- 105
- 131

- 448
- 4
- 15
For a Linux-based OS: I had such an issue due to a corrupted path, but I was able to temporarily fix the issue and my Git installation was immediately restored.
In case you're facing such path issue type the command below
export PATH="/usr/bin:/bin:$PATH"

- 30,738
- 21
- 105
- 131

- 956
- 1
- 7
- 17
Follow this:
- Menu File → Preferences → Settings
- In search, type &rarr the path to the Git executable
- Now scroll down a little. You will see the "Git:path" section.
- Click "Edit in settings.json".
- Now just paste this path there: "C:\Program Files\Git\mingw64\libexec\git-core\git.exe"
Restart Visual Studio Code. Open a new terminal in Visual Studio Code and try "git version".
In case the problem still exists:
- Inside the terminal, click on the terminal options (1:PowerShell)
- Select Default shell
- Select Bash
Open a new terminal and change the terminal option to 2:Bash. Again, try "git version". This should work :)

- 30,738
- 21
- 105
- 131

- 1,496
- 11
- 20
What worked for me was manually adding the PATH variable in my system.
I followed the instructions from Method 3 in this post:
Fix: ‘git’ is not recognized as an internal or external command

- 30,738
- 21
- 105
- 131

- 443
- 4
- 18
If Git is missing after the OS update, in my case macOS v11 (Big Sur), just literally:
brew install git

- 30,738
- 21
- 105
- 131

- 3,250
- 2
- 12
- 26
-
Where? In what environment? In a separate terminal window? Inside Visual Studio Code somewhere? Or somewhere else? – Peter Mortensen Apr 24 '23 at 12:25
I edited Path into System Environment and add "C:\Program Files\Git\bin" then restart Vscode. It's worked for me. I don't understand why I am using it normally then I have this problem. Maybe during the installation of something it causes that problem.

- 891
- 1
- 9
- 20
It worked for me just by installing Git for Windows from Download for Windows.
There wasn't any need to set environment variables or path.
Context: I had installed Visual Studio Code, and GitHub Desktop. I cloned the repository using GitHub Desktop.
When I opened the repository, using Visual Studio Code, I saw this error.
I resolved it by installing Git for Windows.

- 30,738
- 21
- 105
- 131

- 13,461
- 8
- 60
- 73
Windows 10
Nothing helped me from the answers. The problem appeared in IntelliJ IDEA and Visual Studio Code.
The Git tab in Visual Studio Code offered me to Init the Repository. It didn't detect that there was a .git
folder in the workspace.
When I performed a git pull
from a console in Visual Studio Code, it asked me to add credentials by the web browser. After I was logged in, the Git problem was fixed and all plugins started working.
I needed to do that for each cloned repository even if I used proper credentials during a git clone ...
command.
PS. I cloned the repository from GitLab by HTTPS on Windows using CMD. Visual Studio Code uses PowerShell, and that might be the reason.

- 30,738
- 21
- 105
- 131

- 801
- 1
- 10
- 26
On Windows 10:
My problem was that I cloned the repository with PowerShell started in Administrator mode. When I don't start PowerShell in system Administrator mode, Visual Studio Code can detect the Git repository.

- 30,738
- 21
- 105
- 131

- 1,251
- 1
- 15
- 28
I had the same issue after updating my macOS to macOS v13 (Ventura)!
I used the following command and it worked for me!
git --version
To confirm if you have Git installed already and if not run
brew install git
to install the latest version.
After a successful installation, run
brew link git
to link the path and if it says Could not symlink because target already exist*, you can run
brew link --overwrite git
to overwrite it.

- 30,738
- 21
- 105
- 131

- 37
- 2
- 10
Although many people answered already, but for me it the installation method or path setting wasn't the cause of problem.
Maybe future version of VSCode might show the proper error message, but it was the bad .gitconfig
configuration causing VSCode to undetect git.
So, as someone might answered, if path setting doesn't work for you, might check git status
first would be good.

- 63
- 1
- 3