DennisWPaulsenJR
DennisWPaulsenJR

Reputation: 483

Android Studio "Error Running Git" , 'Empty git --version output:'

I have looked at the other posts and have made certain that the path is correct to the executable file, as shown below. I can launch git from from this path outside of Android Studio. The current project is the "sunshine-version 2" from Udacity and it is a version or two old, but this should not affect the VCS from launching. I have read the other posts concerning this issue, but none have resolved this issue. enter image description here Also, when Android Studio gradle runs, it will open git in several windows and then close them almost immediately. They pop-up for a second or two, and then close. It's definitely trying to run git, and then default closes?

Upvotes: 17

Views: 17989

Answers (10)

POA
POA

Reputation: 1

I notice a lot of the answers here are correct, depending on given user's circumstances, so I am consolidating and clarifying which is which. Hopefully, someone who comes across this finds it helpful.

When an application with Git integration support requests the location of the executable (or you want to add its location to your PATH environmental variable so that git commands work on the command line without including the full path to the executable), that location depends on a few variables:

  1. whether you installed Git as an admin (for all Users); and,
  2. whether you installed the 64-bit / 32-bit version of Git

If git commands work on the command line already

Then it is already properly configured as an environmental variable, and you can simply run:

In terminal/command console:

git --exec-path

In PowerShell:

Get-Command git

Running either of the above should get you the path to your git executable.

If you installed the 64-bit version of Git for all users (or as an administrator)

The path to your git.exe executable should be:

C:\Program Files\Git\cmd\

If you installed the 32-bit version of Git for all users (or as an administrator)

The path to your git.exe executable should be:

C:\Program Files (x86)\Git\cmd\

If you installed the 64-bit OR 32-bit version of Git as a regular user

The path to your git.exe executable should be:

C:\Users\%USERPROFILE%\AppData\Local\Git\cmd\

Note: Replace %USERPROFILE% with name of the User whose account is the account on which Git is installed or you can simply paste the above into the address bar of a File Explorer window and press Enter to see if it's a valid location. Alternatively, the below should work as well:

%LOCALAPPDATA%\Git\cmd\

File Explorer 'understands' that %LOCATION% variables should be substituted and the value that should replace it. Notice that git.exe is intentionally excluded from the location to which we direct File Explorer because including it will effectively tell File Explorer to open git.exe which isn't the goal.

If you installed GitHub Desktop, do NOT try to use the included git.exe for third-party application integration!

Important to note that using the git executable that comes packaged with GitHub Desktop is not recommended* to using the embedded git executable that is packaged with GitHub Desktop to integrate other applications. You should install Git for Windows SCM to acquire the appropriate git.exe.


* Good explanation why: GitHub Desktop Official Repository - Issues section

Upvotes: 0

Ashana.Jackol
Ashana.Jackol

Reputation: 3144

in windows 10, 64bit version your installed git location is C:\Program Files\Git, There is a bin folder inside Git folder and there is a git.exe file, this is the file you have to choose or add in android studio.Works for me.

Upvotes: 8

RAKESH CHAUDHARI
RAKESH CHAUDHARI

Reputation: 11

You should give a path in git.exe in cmd folder

Try this: C:\Program Files\Git\cmd\git.exe

Upvotes: 1

Ali Aryan
Ali Aryan

Reputation: 1

you should go into the "cmd" folder which is created in the main folder that you've installed the Git program. (usually is C:\Program Files\Git). In this folder you can find Git.exe then copy this address in configuration windows in Android Studio.

Upvotes: 0

Ekeuwei
Ekeuwei

Reputation: 281

For x64-bit Windows version change the path directory to

Android Studio:  File > Settings... > Version Control > Git

c:\Users\AppData\Local\GitHubDesktop\app-<version>\resources\app\git\cmd\git.exe

Change default settings on Android Studio

Upvotes: 0

netoliguz
netoliguz

Reputation: 306

I just went to the Git path ubication, the only different thing that I did was have stopped at the cmd folder. As you might see in the next screenshot

enter image description here

Subsequently, instead of choosing git-gui.exe option, I select just git.exe option. And it seems to work for me.

enter image description here

Upvotes: 29

KARAN SHAH
KARAN SHAH

Reputation: 323

This is the path where GitHub is located in its default installation. Remove the text including "<>" characters in below path and enter your relevant values.

c:\Users\<Your Windows username>\AppData\Local\GitHubDesktop\app-<version>\resources\app\git\cmd\git.exe

Upvotes: 0

AhuraMazda
AhuraMazda

Reputation: 470

default path of git.exe for GitHubDesktop 64-bit version is

c:\Users\AppData\Local\GitHubDesktop\app-<version>\resources\app\git\cmd\git.exe

you should try this path.

Upvotes: 10

Mogician Ha
Mogician Ha

Reputation: 85

As mentioned by Marina-MSFT, you should add git.exe instead of git-base.exe or any other .exe files. You could find git.exe under, in your case, C:\Users\Computer\Documents\Development\Git\bin\git.exe, normally the git.exe file is under bin file of Git you have installed

Upvotes: 1

Marina Liu
Marina Liu

Reputation: 38136

The path you configure for git should be C:\Users\Computer\Documents\Development\Git\cmd\git.exe instead. You should use git.exe not git-base.exe.

And add git installed path to environment variables (for windows OS):

This PC -> properties -> Advanced system setting -> advanced Tab -> environment variables -> find path in system variables -> edit -> add the git installed path by ;C:\Users\Computer\Documents\Development\Git\cmd -> ok.

Upvotes: 4

Related Questions