16

Facing error as "Git not found" in VS Code in Mac OS Ventura.

How to resolve this error in VS Code on mac? Any Help is appreciated :)

NOTE: My GIT is working fine in Terminal but only isn’t recognized in VS Code Source Control (3rd Icon in the left bar)

Sudir Krishnaa RS
  • 367
  • 1
  • 2
  • 9
  • 1
    did you try installing git? – javajaba Nov 02 '22 at 15:24
  • 1
    Note that Apple-Git (the Apple-modified version) is part of the Xcode tools, and is annoyingly installed and removed somewhat unpredictably by various Apple upgraders. You may want to install the Homebrew Git, which is more up to date; it's possible to install both, although then things are a bit confusing. – torek Nov 02 '22 at 15:36
  • @SudirKrishnaaRS why are you reposting your comment in multiple threads? If one of these answers worked for you, mark it as the solution... – Spencer Nov 03 '22 at 15:00

4 Answers4

15

Just found this solution and this works :

I have also attached the solution screen recording : https://youtu.be/vFJCrzlPOow

GIT NOT FOUND ERROR IN VS CODE (Mac OS Ventura)

Step 1: Check if git is installed in your system by running the below command

   git -version

Step 2: Find the path where GIT is installed by running the below command

    which git

Step 3: Open Visual Studio Code, navigate VS code -> Preferences -> Settings -> Search "git path" in the settings search box -> "Edit in settings.json" (in the first option)

      "git.path", "paste_your_git_path_here"

(Hint: Follow Step 2 to find the path)

This helped solve the VS Code Git not found error!!

Thank You :)

Sudir Krishnaa RS
  • 367
  • 1
  • 2
  • 9
  • 2
    This answer should be downvoted. The right solution is to install the Command Line Tools for the new version – Roberto Cinetto Nov 03 '22 at 15:42
  • 4
    No, not necessarily. This solution worked for me. For some reason, after upgrading to Ventura, my git.path variable was missing. – Futureproof Nov 07 '22 at 18:05
  • 1
    I also upgraded to Ventura (M1 chip) and `git --version` returned `xcrun: error: invalid active developer path`. Running `xcode-select --install` solved it. Didn't need to do Step 3 in this solution. – Sam A. Dec 05 '22 at 14:32
  • 1
    The approach works for me, `which git` did the trick – dhilt Jan 26 '23 at 10:23
  • "git.path": "/usr/local/bin/git" helped me – Anand Varkey Philips Feb 28 '23 at 19:35
  • The command line tools were installed and I had this issue. After running `git -version` it had me accept the new Xcode license agreement (which I had to re-view using `sudo xcodebuild -license`), at which point I didn't need to add "git.path" – Matthew Dean Mar 31 '23 at 18:58
13

You can install git using xcode-select --install to install the Apple version, or you can get the upstream one with brew install git. Check https://brew.sh or alternatively, https://git-scm.com/downloads.

Menace
  • 417
  • 3
  • 10
  • 3
    After installing Command Line Tools via `xcode-select --install` it still wasn't working. Turns out I had to accept the license before git would work. `which git` returned a valid `/usr/bin/git` however `git --version` prompted me to agree to a license. You can do the license step directly with `sudo xcodebuild -license`. Be careful if you're rapidly paging through the file, as if you hit the wrong key at then end you'll exit and won't be able to agree. Once I agreed to the license terms and reloaded VSCode, it worked. – user1993951 Nov 30 '22 at 18:07
4

If you run git -v you'll get an error message saying that you have not installed xcode

This should work: Open your terminal and run xcode-select --install

AnwarMEQOR
  • 51
  • 4
3

It is because you need to accept the Xcode license again after installing the update. Resolve this by running:

sudo xcodebuild -license accept

vscode will get back normal after you accept the license.

Lewis
  • 63
  • 4