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

10

17

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?

Ables answered 8/2, 2017 at 22:17 Comment(5)
Also, when I click on "Test" , a scroll bar pops up, but spins its wheels endlessly. There is no result, but an unending 'check' if you will...Ables
Can you execute this from a command prompt? Also, you have a git path set, but also have Built-in selected.Acanthaceous
I changed it from 'built-in' to the only other option...'Native' and the same error occured.Ables
Native would be the path specified. It is strange that built-in would give the same error. Can you try Built-in without a path specified? Can you execute this from a command prompt?Acanthaceous
yes, from the 'native' or from the 'built-in' options, it is throwing the Empty git --version output response, when I click the "Test" button. I can launch this executable file from the command line.Ables
S
29

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

Sadonia answered 10/10, 2017 at 0:16 Comment(2)
this one helped me a lotEnvirons
This one helped me as well. I had to change the path to executable to 'bin/git.exe'Isogonic
G
10

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.

Generous answered 27/7, 2017 at 11:57 Comment(0)
S
8

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.

Struck answered 16/1, 2019 at 9:55 Comment(0)
C
4

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.

Contumacy answered 9/2, 2017 at 1:37 Comment(7)
I tried 'git.exe' but it said no such file. I double checked the path and it is definitely to the right executable file.Ables
Which version do you use for git? Or you can download the newest version in git-scm.com/downloads. And then use the new install path ...\Git\cmd\git.exe.Contumacy
I am using the latest version of git. Also, I have GitHub set as version control for the current project. It has no problem connecting when I click on 'Test', but I would like to use git locally, and then push/pull to GitHub. For some reason it keeps throwing this Empty version output message. I have even deleted the entire studio, and git, and reinstalled both. Not sure where the bug is ? Could there be some setting withiin git that I need to alter...? What's funny is when I browse to the uninstall_git.exe and click on 'Test' , it actually launches the uninstaller for git ?Ables
Did you add C:\Users\Computer\Documents\Development\Git\cmd in your environment variables?Contumacy
I do not know what that is or how to do that...please guide me in this.Ables
Yes, I added the method to add environment variables in my answer.Contumacy
Did the answer you help solve the problem? If yes, please mark it. And it will help others who have similar question.Contumacy
P
1

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

Prosecution answered 14/2, 2017 at 8:1 Comment(0)
G
1

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

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

Gualtiero answered 31/10, 2018 at 10:28 Comment(0)
W
0

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
Wallinga answered 5/10, 2017 at 23:3 Comment(0)
T
0

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

Tatary answered 28/8, 2018 at 10:54 Comment(0)
P
0

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.

Peculation answered 25/10, 2018 at 14:9 Comment(0)
F
0

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

Fy answered 24/4 at 17:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.