I installed VS Code on my Mac, and I try to connect it to git. However VS Code indicates that it can’t find git.
I have tried modify the variabele git.path to “/usr/bin” (where I can see that git is installed). However when starting VS Code it still indicates that git is not there.
Drag Visual Studio Code.app to the Applications folder, making it available in the macOS Launchpad. Open VS Code from the Applications folder, by double clicking the icon. Add VS Code to your Dock by right-clicking on the icon, located in the Dock, to bring up the context menu and choosing Options, Keep in Dock.
Open setting. json(or File>Preferences>Settings). Navigate to Workspace Settings. Find "Path" and add paths to Git bin and cmd folders.
I found a specific issue on the vscode github page related to this. The issue submitter's solution to this worked for me, which is to open a terminal and type the following command
sudo xcodebuild -license
This will prompt you to read and then accept the license agreement. Once I did this, I restarted Visual Studio Code and my issue was solved.
Apparently there is some subtle issue that keeps VS Code from recognizing git (or that git is "valid"?) until the xcodebuild license has been accepted.
I had this issue and was able to solve it by installing Xcode Command Line Tools and updating VSCode's settings.json
You can open this file a couple different ways. I like to do ⌘ + Shift + P then type "settings" in the command palette:
If you prefer just to open it, its location is here:
$HOME/Library/Application Support/Code/User/settings.json
Reference: Visual Studio Code User and Workspace Settings
Then plug the following into your workspace settings (ensure that you merge your current config you may have here):
{
"git.path": "/usr/bin/git"
}
And it'll look something like this:
Now close VSCode. If you'd like to use the Terminal you can simply input this command, but you can use the GUI instead if you'd like as I'll show:
xcode-select --install
Wait for the command to complete, then start VSCode. At this point my issue was fixed; hopefully this works for you as well!
Since I'd already installed my XCode tools my dialog won't show up again, but you can see from this image which is referenced below what it looks like. Click "Install".
Both command and image referenced from here: http://railsapps.github.io/xcode-command-line-tools.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With