Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cant find git path in VSCode OSX

So I've had quite some trouble trying to get git and VS Code to work together, I've found the $PATH for git in terminal (/usr/bin/git) but when I try to edit it in settings.json this doesn't seem to work. Null stays. Do you have any other method to get this working? I've even tried exporting the $PATH in terminal.

like image 700
Jean Johnsen Avatar asked Nov 29 '22 08:11

Jean Johnsen


2 Answers

My issue was that Xcode had updated it's legal Terms and I hadn't agreed to them yet so it was blocking VScode from using git. I found this out by running the command

git status

And I got back:

Agreeing to the Xcode/iOS license requires admin privileges, please run “sudo xcodebuild -license” and then retry this command.

So I followed the instructions and agreed to the Xcode/iOS license. Then I restarted VScode and my gitlens extension worked like a charm!

like image 42
Tony Schmidt Avatar answered Dec 09 '22 10:12

Tony Schmidt


I had a similar problem. It was caused by 2 issues:

  1. In VS Code -> Preferences -> Settings, make sure you put this line:

    "git.path": "/usr/bin"

It was set to null in my installation. Also, in the latest version of Code, the user settings are opened in a side window and you add your value there.

  1. If you have Xcode installed, make sure you open it and accept the license agreement. Git was refusing to start in my installation until I accepted the Xcode license.
like image 59
SamG Avatar answered Dec 09 '22 08:12

SamG