UDIT PATEL
UDIT PATEL

Reputation: 123

git.exe error for android studio

Recently I am trying to connect git hub repository to android studio but it shows following the error:

Error Image

Upvotes: 11

Views: 37488

Answers (7)

genericUser
genericUser

Reputation: 7188

Invalidating Android Studio caches solved my issue

I have already configured the git executable path, but sometimes my IDE still raises git not found exceptions.

In order to solve that issue, follow those steps:

  1. Press Shift twice and search for "Invalidate caches"

enter image description here

  1. Press "Invalidate and Restart"

enter image description here

That's it, the issue is solved.

So, why invalidate caches?

Android Studio makes a lot of files as caches and does not delete them. This can cause trouble when making new files is needed, so clearing caches will clear the old cache and make Android Studio faster and rebuild old caches from scratch.

Upvotes: 2

Jeevan Rupacha
Jeevan Rupacha

Reputation: 5866

This is because Android Studio doesn't find the path of git you install even though you have install in local computer .

For this I solve adding the path of git.

  Go to File -> Settings -> Git 
  You can see at first Path to Git Executable 
  Click the file icon  
  Select the file where you have install the git 
  It might be in C drive -> Program Files -> Git 
  Inside Git folder Goto -> bin -> and select git.exe file 
  After that click on test 

Upvotes: 1

Abdulsalam Opeyemi
Abdulsalam Opeyemi

Reputation: 983

Install Git if not already installed.

In android studio click on File -> Settings -> Version control -> Git

Then click to select Path to Git executable

You should find your git.exe file in path: C:\Program Files\Git\cmd\git.exe

enter image description here

Upvotes: 11

Tamim Attafi
Tamim Attafi

Reputation: 2521

I know this might sound stupid but yes, it is as stupid as it is!

I had this same error on Linux and was searching for a solution for two days! Then one day was trying to solve this, by chance, I cleared the path specified in android studio and Voilà! Android studio auto detected my git (facepalm)! And the interesting thing is it was not the path I was pointing to (bin/usr/git), and not the path returned by which git command (same path), it was /app/bin/git

For intellij idea and other products of JetBrains is quite the same issue, but the path detected by the two is different! Intellij idea was pointiong to /usr/bin/git!

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.

Upvotes: 0

ajay.kumar
ajay.kumar

Reputation: 173

get a git path from your pc

go to my computer >open c:drive > Users>YourUser>Appdata>Local>Github>PortableGit_\cmd\git.exe

then copy the file location and past it into your git executable path in android studio as shown in the above image

Upvotes: 8

Samson Muwanguzi
Samson Muwanguzi

Reputation: 11

For my case git.exe was in the Path C:\Users\Username\ AppData\Local\GitHubDesktop\app-<appversion>\resources\app\git\cmd\git.exe

Upvotes: 1

Mukesh M
Mukesh M

Reputation: 2290

Git Android Studio

Go to Settings-->Version Control-->Git and Fix Path to Git executable. Also click test button to check it is working.

Upvotes: 7

Related Questions