[android] Android Studio: Can't start Git

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?

This question is related to android git android-studio

The answer is


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


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


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.


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


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.


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


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.


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

xcode-select --install

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


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.


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.


Had to restart Android Studio after installing GIT for Windows.


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.


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


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.


In Windows, my git was located at

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


Examples related to android

Under what circumstances can I call findViewById with an Options Menu / Action Bar item? How to implement a simple scenario the OO way My eclipse won't open, i download the bundle pack it keeps saying error log getting " (1) no such column: _id10 " error java doesn't run if structure inside of onclick listener Cannot retrieve string(s) from preferences (settings) strange error in my Animation Drawable how to put image in a bundle and pass it to another activity FragmentActivity to Fragment A failure occurred while executing com.android.build.gradle.internal.tasks

Examples related to git

Does the target directory for a git clone have to match the repo name? Git fatal: protocol 'https' is not supported Git is not working after macOS Update (xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools) git clone: Authentication failed for <URL> destination path already exists and is not an empty directory SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443 GitLab remote: HTTP Basic: Access denied and fatal Authentication How can I switch to another branch in git? VS 2017 Git Local Commit DB.lock error on every commit How to remove an unpushed outgoing commit in Visual Studio?

Examples related to android-studio

A failure occurred while executing com.android.build.gradle.internal.tasks "Failed to install the following Android SDK packages as some licences have not been accepted" error Android Gradle 5.0 Update:Cause: org.jetbrains.plugins.gradle.tooling.util This version of Android Studio cannot open this project, please retry with Android Studio 3.4 or newer WARNING: API 'variant.getJavaCompile()' is obsolete and has been replaced with 'variant.getJavaCompileProvider()' Flutter plugin not installed error;. When running flutter doctor ADB.exe is obsolete and has serious performance problems Android design support library for API 28 (P) not working Flutter command not found How to find the path of Flutter SDK