Git not found. Install it or configure it using the 'git.path' setting
Asked Answered
C

6

24

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)

Cowling answered 2/11, 2022 at 15:20 Comment(3)
did you try installing git?Supposititious
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.Wanids
@SudirKrishnaaRS why are you reposting your comment in multiple threads? If one of these answers worked for you, mark it as the solution...Handbook
C
23

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 :)

Cowling answered 2/11, 2022 at 16:4 Comment(6)
This answer should be downvoted. The right solution is to install the Command Line Tools for the new versionDink
No, not necessarily. This solution worked for me. For some reason, after upgrading to Ventura, my git.path variable was missing.Hopefully
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.Columbuscolumbyne
The approach works for me, which git did the trickTitanesque
"git.path": "/usr/local/bin/git" helped meSteelman
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"Hosier
B
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.

Buyse answered 2/11, 2022 at 15:39 Comment(1)
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.Kohler
D
11

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.

Denary answered 20/12, 2022 at 6:58 Comment(2)
This is probably very common for many developers who have Xcode on their system, even if they don't use Xcode often. In fact, especially if they don't use Xcode often, since it's easy to forget it's on there. Great suggestion!Lives
After upgrading to Sonoma and updating Xcode as well, vscode started to complain with Git not found. Install it or configure it using the 'git.path' setting. Typing any git command on the terminal confirmed your solution would solve my case, since it complained as well: You have not agreed to the Xcode and Apple SDKs license. You must agree to the license below in order to use Xcode. Accepting the license solved it. Thanks!Register
C
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

Canter answered 19/11, 2022 at 15:41 Comment(0)
B
1

When you have installed git and also the correct version but still vs code is not recognizing then try changing git path from /usr/local/bin/git to /usr/bin/git. This will work.

Behring answered 22/2 at 7:17 Comment(0)
E
0

It's pretty simple,

  1. Search for Preferences: Open User Settings.
  2. Search for "git.path" in the search bar.
  3. Run which git in the terminal and copy the output into the "git.path" field.
Emprise answered 8/4 at 16:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.