Android Studio: Can't start Git

AndroidGitAndroid Studio

Android Problem Overview


When I start Android Studio there's a message

> Can't start Git: C:\Program Files (x86)\Git\cmd\git.cmd Probably the > path to Git executable is not valid. Fix it.

But I can see that the git.cmd IS there. How do I fix the issue then?

Android Solutions


Solution 1 - Android

For some reason this morning, I had to agree to the terms and conditions by running git as administrator in the command line.

On the mac

sudo /usr/bin/git

On the pc

c:\path\to\git.exe

Accept the EULA.

After I did that, I was able to use git in my IDE.

Solution 2 - Android

For the one using mac who installed Xcode7, you have to start Xcode and accept the license agreement for the android studio error to go away.

Solution 3 - Android

Check that C:\Program Files (x86)\Git\cmd is in you Path environment variable:

echo $env:Path

Solution 4 - Android

I had the same problem, this is how I fixed it:

I use windows...

Go to

C:\Users\<username>\AppData\Local\GitHub\PortableGit_c2ba306e536fdf878271f7fe636a147ff37326ad\bin

So in my Account I had this

C:\Users\victor\AppData\Local\GitHub\PortableGit_c2ba306e536fdf878271f7fe636a147ff37326ad\bin

Make sure you find the git.exe

Then go to the VCS window(Settings --> Version Control---> Git), and paste the PATH and append git.exe at the end

So you shall have this

C:\Users\<username>\AppData\Local\GitHub\PortableGit_c2ba306e536fdf878271f7fe636a147ff37326ad\bin\git.exe 

Then click test to verify if git is working well.

Solution 5 - Android

In my case, with GitHub Desktop for Windows (as of June 2, 2016) & Android Studio 2.1:

This folder ->

C:\Users\(UserName)\AppData\Local\GitHub\PortableGit_<hash>\

Contained a BATCH file called something like 'post-install.bat'. Run this file to create a folder 'cmd' with 'git.exe' inside.

This path-->

C:\Users\(UserName)\AppData\Local\GitHub\PortableGit_<hash>\cmd\git.exe

would be the location of 'git.exe' after running the post-install script.

Solution 6 - Android

Try this...

  1. Make sure, have you installed git on your machine. If not you can download(Windows user) from here and install it your system. For Mac user can download from here

  2. Get location of git.exe Get location of git.exe

  3. Test git.exe manually test

  4. Now you can set your git.exe location in android studio.

Solution 7 - Android

Had to restart Android Studio after installing GIT for Windows.

Solution 8 - Android

If you are using Mac OS and have updated XCode you probably need to open XCode and accept the terms to avoid this error.

Solution 9 - Android

Use bin folder and exe instead. Path will be C:\Program Files (x86)\Git\bin\git.exe

Also sometimes it doesn't work if there are blank spaces in path name as in your program files directory name.

In that case, copy the whole git folder to root of partition and then link studio to it

Solution 10 - Android

First make sure you have installed git scm or not. If not, here's the link for windows: https://git-for-windows.github.io/ Then go to Android studio and configure the link of Git to the place where you installed your git(probably in C:/program files) I referred to a YouTube video to solve my issue. You can refer it here: https://www.youtube.com/watch?v=faEd2syXypE

Solution 11 - Android

I showed my hide directories in windows 7 and find git.exe in C:\Users\(UserName)\AppData\Local\GitHub\PortableGit_c2ba306e536fdf878271f7fe636a147ff37326ad\bin\ and it works but I don't know why git.exe is there. I installed git version 1.9.5

Solution 12 - Android

In Android Studio, goto File->Settings->Version Control->Git. Set the 'Path to Git Executable' to point to git.exe. Verify by clicking Test.

Solution 13 - Android

In Windows, my git was located at

C:\Users\<username>\AppData\Local\Programs\Git\bin\git.exe

Solution 14 - Android

To fix this, I did a reinstall of xcode (This also presented user agreement). I used the following command:

xcode-select --install

Solution 15 - Android

The path for your git is invalid. Copy the path from File -> Settings -> Version Control -> Git and search that folder and you can see the path to your Git is not valid. Reset the path with correct location and test it. The error should be gone.

Solution 16 - Android

Run sudo git --version from command line and agree to the license and this should fix the issue.

Solution 17 - Android

I faced a similar issue, you can refer to my answer here.

But since links die too often, I'm going to leave a little part of the answer that might help:

> For people still having this error even if their git is installed > and android studio is pointing to its path, go to Settings -> > Version Control -> Git and delete everything inside the text box > with the label Path to Git executable, your android studio or what > ever JetBrains product you're using, will auto-detect it.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAlexander KulyakhtinView Question on Stackoverflow
Solution 1 - AndroidtylerView Answer on Stackoverflow
Solution 2 - AndroidDistwoView Answer on Stackoverflow
Solution 3 - AndroidKlas MellbournView Answer on Stackoverflow
Solution 4 - AndroidVictor MwendaView Answer on Stackoverflow
Solution 5 - AndroidCram KView Answer on Stackoverflow
Solution 6 - AndroidSilambarasan PoongutiView Answer on Stackoverflow
Solution 7 - AndroidOneWorldView Answer on Stackoverflow
Solution 8 - AndroidneteinsteinView Answer on Stackoverflow
Solution 9 - AndroidanandbibekView Answer on Stackoverflow
Solution 10 - AndroidChirag MakhijaView Answer on Stackoverflow
Solution 11 - AndroidJJ PerezView Answer on Stackoverflow
Solution 12 - Androidben_josephView Answer on Stackoverflow
Solution 13 - AndroidSalGadView Answer on Stackoverflow
Solution 14 - AndroidkarmaView Answer on Stackoverflow
Solution 15 - AndroidOmamaView Answer on Stackoverflow
Solution 16 - AndroidSandeepView Answer on Stackoverflow
Solution 17 - AndroidTamim AttafiView Answer on Stackoverflow