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
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
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 toSettings
->Version Control
->Git
and delete everything inside the text box with the labelPath 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
Source: Stackoverflow.com