OS X - Can't start Git: /usr/bin/git Probably the path to Git executable is not valid
GitMacosAndroid StudioGit Problem Overview
I get this error in Android Studio:
> Can't start Git: /usr/bin/git > Probably the path to Git executable is not valid.
It gives me an option to fix it, where it takes me to the area in Android Studio to set the path to git. I see it is set to
> /usr/bin/git
And I check that path, and that path is indeed the path to the git executable. Why is Android Studio unable to start git?
EDIT: When I try to use git commands in the Android Studio terminal it says:
> Agreeing to the Xcode/iOS license requires admin privileges, please > re-run as root via sudo.
Git Solutions
Solution 1 - Git
You should run sudo git --version
on your command line.
It will ask you to agree to the git xcode license agreement, once done everything will work as before.
Solution 2 - Git
When upgrading to MacOS Sierra I had to run: xcode-select --install
Solution 3 - Git
I got this problem too, because I uninstalled my Xcode.
I solved it with these steps:
-
Type
xcode-select --install
in the terminal (Installs the license) -
Download a git and re-install it
After this 2 steps, I can use git commands in the terminal like git
or git --version
.
But when I open the android studio, it still show the error
so we need another two steps:
-
Type
which git
in your terminal (find out the git path) -
Configure the path (you got in the step 3) in your android studio , then apply
It works for me.
Solution 4 - Git
You should agree explicitly to user's licence agreement.
This is how you should do it:
- Open terminal
- run the following command:
sudo xcodebuild -license
- agree to the terms.
That's it! :)
Solution 5 - Git
use "which git" in terminal. It will provide you your git location. like "/usr/local/bin/git" paste this location in popup which came after clicking "Fix it". Then click apply.
Solution 6 - Git
In terminal
sudo xcodebuild -license accept
Solution 7 - Git
I tried "/usr/local/bin/git" path and clicked "Test" button but was getting error.
so I clicked on three dots besides Test button and jumped to the given path but there was no git executable present. So at below path I found git exec:
/usr/local/git/bin/git
I hope it helps.
Solution 8 - Git
In my situation I used "which git" in terminal. It will provide me my git location like "/usr/local/bin/git" instead of "/usr/bin/git" I pasted this location in popup which came after clicking "Fix it". Then clicked apply and it works.
Solution 9 - Git
I met a same problem. Idea indicate that: Can't start Git: /user/bin/git... And I run "which git" on terminate and I found that my git stay on: /user/local/bin/git So what I need is change git's path on project setting. And it worked.
Solution 10 - Git
I had updated Xcode last night. I ran git as root via sudo in the terminal and then it said I have not agreed to the Xcode licence terms, and allowed me to view them and then agree in the terminal. I probably would have got the GUI version if I tried to open Xcode.
Solution 11 - Git
When I installed MacOS Sierra I ran xcode-select --install
and it worked fine
Solution 12 - Git
I my case I've changed the name of Xcode app to Xcode9 and renamed later to Xcode.
I needed to update my Xcode.app path.
After typing sudo xcode-select --switch /Applications/Xcode.app
on terminal everything worked fine again
Solution 13 - Git
sudo xcode-select --reset
in the terminal instantly solved the problem for me.
Solution 14 - Git
I had the same problem in PhpStorm. This came to me after updating XCode on OS X EL Capitan. After this update I didn't open it to accept the license that was necessary for XCode and OS X. When I had accept the license the problem was resolved.
Solution 15 - Git
I have this issue when having two Xcode (ver.7 and ver.8) apps installed in my Mac OS Sierra.
What I do is simply open the Xcode 8, go to Preferences, select Locations in tab, and set the Command Lines Tools to Xcode 8.0.
Solution 16 - Git
-
Run sudo git --version
-
If already Xcode is installed : Run sudo softwareupdate -ia --verbose If not : xcode-select --install sudo xcodebuild -license
-
sudo xcode-select -switch /Library/Developer/CommandLineTools
After this don’t forget to re-start the system. It worked for me and for sure work you you as well.
Solution 17 - Git
Download git from https://git-scm.com after download install it and then in terminal type which git you will get git path
Satishs-MacBook-Air:~ Pathuri$ which git
/usr/local/bin/git
Satishs-MacBook-Air:~ Pathuri$
click on apply and fit it on the pop up it will solve .
Solution 18 - Git
If you recently installed Jetbrains Toolbox:
Uninstall and installing through the Toolbox solved the problem for me.
Solution 19 - Git
Just run "/usr/local/bin/git" on terminal.
Solution 20 - Git
At first try to restart your pc, if you just installed git.