OS X - Cannot start Git: / usr / bin / git Perhaps the path to the Git executable is invalid

I get this error in Android Studio:

Cannot start Git: / usr / bin / git Probably the path to the Git executable is not valid.

This gives me the opportunity to fix it when it takes me to an area in Android Studio to set the path to git. I see that it is set to

/ Usr / bin / git

And I check this path, and this path is really the path to the Git executable. Why can't Android Studio start git?

EDIT: when I try to use Git commands in an Android Studio terminal, it says:

Consent to an Xcode / iOS license requires administrator privileges, please restart as root via sudo.

+96
git android-studio macos
Sep 18 '15 at 9:42
source share
19 answers

You should run sudo git --version on the command line. He will ask you to agree to the git xcode license agreement after everything works as before.

+186
Sep 19 '15 at 19:20
source share

When upgrading to MacOS Sierra, I had to run: xcode-select --install

+85
Sep 22 '16 at
source share

You must expressly agree to the user license agreement.

Here's how you should do it:

  • Open terminal
  • run the following command: sudo xcodebuild -license
  • agree to the terms.

What is it!:)

+46
Oct 27 '15 at 19:42
source share

I have this problem too, because I deleted my Xcode.

I solved this with the following steps:

  1. Type xcode-select --install in terminal (install license)

  2. Download git and reinstall it

After these two steps, I can use the git commands in the terminal, for example git or git --version .

But when I open android studio, it still shows error

so we need two more steps:

  1. Enter which git in your terminal (find out the git path)

  2. Set up the path (you got in step 3) in your Android studio, then apply

As below pic. enter image description here

It works for me.

+30
Nov 23 '16 at 11:18
source share

use "which git" in the terminal. It will provide you your git location. for example, "/ usr / local / bin / git" paste this location into the pop-up window that appeared after clicking "Fix". Then click "Apply."

+11
May 03 '17 at 7:35 a.m.
source share

In terminal

 sudo xcodebuild -license accept 
+9
Jun 20 '16 at 4:35
source share

In my situation, I used "which git" in the terminal. It will give me my git location like "/ usr / local / bin / git" instead of "/ usr / bin / git". I pasted this location into the popup that appeared after clicking "Fix." Then click and apply and it works.

+6
Dec 04 '17 at 11:01
source share

I ran into the same problem. The idea indicates that: Cannot start Git: / user / bin / git ... And I run "which git" at the end, and I found that my git stays at: / user / local / bin / git therefore I need to change the git path to setting up the project. And it worked.

+4
Jan 05 '16 at 14:03
source share

I updated Xcode last night. I ran git as root via sudo in the terminal, and then said that I did not agree with the Xcode license terms and allowed me to view them and then agree to the terminal. I would probably get a version of the GUI if I tried to open Xcode.

+3
Sep 19 '15 at 0:24
source share

When I installed MacOS Sierra, I ran xcode-select --install and it worked fine

+3
Apr 19 '17 at 10:13
source share

I had the same problem in PhpStorm. This came to me after upgrading Xcode to OS X EL Capitan. After this update, I did not open it to accept the license required for Xcode and OS X. When I accepted the license, the problem was resolved.

+1
Sep 16 '16 at 9:43
source share

I have this problem when two Xcode applications (ver.7 and ver.8) are installed on my Mac OS Sierra.

What I'm doing is just open Xcode 8, go to Settings , select the Location tab and set the Command Line Tools to Xcode 8.0 .

+1
Sep 21 '16 at 14:38
source share

In my case, I changed the name of the Xcode application to Xcode9 and later renamed Xcode.

I needed to update my Xcode.app path.

After entering sudo xcode-select --switch/Applications/Xcode.app on the terminal everything worked fine again

+1
May 16 '18 at 12:27
source share

sudo xcode-select --reset in terminal instantly solved the problem for me.

+1
Sep 28 '18 at 14:26
source share

I tried the path "/ usr / local / bin / git" and clicked the "Test" button, but got an error.

so I clicked on three points, except for the Test button, and jumped to the given path, but there was no git executable. So, on the way below, I found git exec:

/ Usr / local / bastard / bin / bastard

I hope this helps.

+1
Dec 05 '18 at 10:36
source share

Download git from https://git-scm.com after downloading, install it, and then in the terminal enter which git you will get the git path

Satishs-MacBook-Air: ~ Pathuri $ which git

/ usr / local / bin / git

Satishs-MacBook-Air: ~ Pathuri $

click to apply and paste it into the popup that it solves.

0
Nov 10 '17 at 11:18
source share

If you recently installed Jetbrains Toolbox:

Removing and installing with Toolbox solved the problem for me.

0
Jan 24 '18 at 17:36
source share
  1. Run sudo git --version

  2. If Xcode is already installed: Run sudo softwareupdate -ia --verbose If not: select xcode --install sudo xcodebuild -license

  3. sudo xcode-select -switch / Library / Developer / CommandLineTools

After that, do not forget to restart the system. It worked for me, and for you, of course, for you.

0
Dec 17 '18 at 9:37
source share

A very simple solution, just restart your Mac.

0
Dec 21 '18 at 7:13
source share



All Articles