4

My machine has been using on Window 8 x64. I have installed Git on my Windows, everything has worked fine. I have configured the "Path to git executable" setting of my IDE (PhpStorm IDE) to the git exe which could be found on the following answer

Where is Git exe located

Here is the location where git.exe has been located on my computer C:\Users[computer-name]\AppData\Local\GitHub\

But today, I got a message from my IDE: Can't start Git: git.cmd. Probably the path to Git executable is not valid. Fix it. (show balloon)

I have checked and the git.exe or git.cmd, they have been gone, I don't know why. I have tried to reuse the GitHubSetup which I've used for installing to repair or reinstall but the GitHub app was still opened normally because it seemed there never has problem with itself. The Github is working on my machine, I can see my repository, commit, etc. But I would like the git.exe to configure for my IDE.

How could I get back that missing file (git.exe)?

Community
  • 1
  • 1
Telvin Nguyen
  • 3,459
  • 4
  • 22
  • 38
  • 2
    I would consider installing "stock" [Git for Windows](http://www.git-scm.com/download/win) and make your IDE use it. As to why they're gone -- are you sure your anti-virus software did not move them to a quarantine area or something like this? – kostix Jul 26 '13 at 10:03
  • I've not been using the anti virus, but thanks for your suggestion, it makes sense since I've installed github service, not git http://stackoverflow.com/questions/13321556/difference-between-git-and-github – Telvin Nguyen Jul 26 '13 at 14:52
  • As an aside, Symantec Antivirus Cloud does not like the "gitk.exe": "Trojan.Gen.SMH in c:\users\${USER}\appdata\local\github\portablegit_${HASHSUM}\cmd\gitk.exe" ... not sure whether false positive. – David Tonhofer Mar 29 '16 at 08:23

5 Answers5

7

If Git is still available from the command line, then the binary is still around. Have you tried locating it with a search (with bash you could use $ which git to tell you the location. Don't know an equivalent for the Windows command line though)? When you find it, you could try to copy it over to the location you need it for your IDE.

Max Leske
  • 4,774
  • 6
  • 40
  • 50
  • Yeah, I have searched that file on my computer and no result found. – Telvin Nguyen Jul 26 '13 at 08:56
  • 2
    So can you use Git from the command line? I quickly checked for a `which` equivalent and found this SO question: http://stackoverflow.com/questions/304319/is-there-an-equivalent-of-which-on-the-windows-command-line. So try `where git` on your shell and see what you get. – Max Leske Jul 26 '13 at 10:25
  • 2
    Here is the output C:\Users\[PC-Name]\AppData\Local\GitHub\PortableGit_015aa71ef18c047ce8509ffb2f9e4bb0e3e73f13\cmd\git.exe The funny thing is after I restarted my IDE, everything worked fine again without do anything else. Anyway, I will mark your answer since it resolved the point of my question. – Telvin Nguyen Jul 26 '13 at 14:41
2

Since Git has several installation options I would like to point out that this solution is not for everyone.

This solution is for the following case:

  • OS : Windows 8 (not applicable for any other version)
  • Git is installed as a Command Line Tool
  • Git is installed at a default preset location

The git executable(sh.exe) for Command Line Tool is a script that in order to work will be based on the your windows Command Prompt (cmd.exe)

You will need the following string to refer to Git correctly as an executable:

C:\Windows\SysWOW64\cmd.exe /c ""C:\Program Files (x86)\Git\bin\sh.exe" --login -i"
Tim Cason
  • 626
  • 6
  • 12
2

Best solution and this will definitely work

  1. Open you GitHub app and go in setting
  2. Go in About GitHub Desktop App
  3. Then click on open debug log
  4. Find git.exe in that txt file and then you will know current path that this using by GitHub Desktop app.
Faisal Khan
  • 2,374
  • 3
  • 17
  • 35
1

I had the same problem.

I solved it by reinstalling git and pointed the "path to git executable" in PHPStorm to the git installed path.

Click here to download git

path for the git: YourInstalledFolder\Git\bin\git.exe

I saw the the default PHPStorm git path is git.exe. It means that you could have a greater chance if you install git in the same directory where PHPStorm is installed.

Jesper Rønn-Jensen
  • 91,561
  • 40
  • 112
  • 147
Wenping Guo
  • 622
  • 7
  • 9
0

I ran into this problem today after an update. Github Desktop does not update the path variable when updating, and changes a folder name to match the version number, so you need to update the path everywhere it is located. (Why can't IDEs use the path variable).

John Glen
  • 445
  • 2
  • 14