28

I'm using Chocolatey (v0.9.8.27) as a package manager for Windows. I've installed multiple packages, and they all run fine, but for some reason Git isn't working.

The command I used was choco install git. It downloads git and git.install to the lib folder, and says that the install finished successfully, but nothing ends up in the bin folder. When I try to start Git, I get an error about it not being a recognized command.

My first thought was to check my environment variables, but I don't even see any executables to point to. Has anyone else come across this before?

Peter Mortensen
  • 28,342
  • 21
  • 95
  • 123
Rob
  • 9,433
  • 12
  • 52
  • 87
  • 3
    Now type refreshenv (if you are in cmd.exe). Otherwise close and reopen shell. Native install goes to PATH, not to bin – ferventcoder Aug 05 '14 at 16:23
  • Ah gotcha. I see what happened - Git installed to Program Files (x86) but the PATH var is just Program Files. Is there something I can configure in Chocolatey to keep that from happening? – Rob Aug 05 '14 at 16:33
  • That could be the package OR the installer. In this case it is likely an issue with the package. – ferventcoder Aug 05 '14 at 16:50

5 Answers5

18

Some folks might be running into this currently as there's an issue with the current version (1.9.5.20150319) of the git.install package.

This can be gotten around by installing the previous version with:

choco install git.install -version 1.9.5.20150114

MushinNoShin
  • 4,105
  • 2
  • 28
  • 45
3

I recently installed Git on my work laptop using Chocolatey, and it worked fine.

Can you mention which version of Chocolatey you are using? Since Chocolatey is just a wrapper around the Git installation package, all it is doing is running the MSI/EXE in the same way that you would do it manually. To that end, you should find the Git files here:

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

And either the MSI/EXE will have added this onto your path variable (I can't remember which one does it), so that you can run it from the command line using just "git".

If this folder doesn't exist, then yeah, something went wrong with the installation. To try to correct this try running:

choco install git -force -debug

And if there are any types of warning/errors displayed I would suggest that you get in touch directly with the package maintainer (in this case it is Rob himself) using the link on the Package page on Chocolatey.org

Gary Ewan Park
  • 13,805
  • 4
  • 29
  • 53
  • Hi Gary - I just upgraded to the latest version (0.9.8.27) and I'm still having the same issue. The debug output says that the output dir is /Chocolatey/lib, which explains why it's there and not in bin. No warnings or errors though. I'll try getting in touch with Rob -- thanks! – Rob Aug 05 '14 at 16:02
  • 6
    Just had the same issue. First time I tried installing git I did it without admin shell, then with as I saw the warning... and it failed. Deleting the bad C:\ProgramData\chocolatey\lib\git.install. directory and running the install again from admin shell fixed it all. – Alexander Kellett Nov 06 '14 at 09:18
3

I had the same error, but I did not want to force a specific version.

I solved it using --force (-f) on the installation behavior on the git.install package.

In this example, I've also added --confirm (-y) and --debug (-d) options to make things more visible:

choco install git.install -yfd

https://chocolatey.org/docs/commands-install

Peter Mortensen
  • 28,342
  • 21
  • 95
  • 123
Giulio Caccin
  • 2,554
  • 6
  • 30
  • 47
2

Try typing "git.exe". That was properly mapped for me.

If you are using choco and PowerShell, this package allows you to call Git commands directly without the ".exe" file extension:

choco install poshgit

You can also use this command in PowerShell to list your environment variables:

(Get-ItemProperty 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment' -Name Path).Path
Peter Mortensen
  • 28,342
  • 21
  • 95
  • 123
Matt Owens
  • 31
  • 1
1

None of the other answers worked for me - I had to delete both the C:\ProgramData\chocolatey\lib\git and C:\ProgramData\chocolatey\lib\git.install directories, and then run choco install git again.

In case it helps anyone else, I think my problem resulted because I had installed Git manually before installing it with Chocolatey. Unfortunately, that resulted in neither being on my path. I uninstalled the one in Programs and Features, and did choco install git -force -debug, hoping that the Chocolatey version would take over, but although I had no errors, there was still no Git on path, and no Git exe to be found.

Erika E
  • 525
  • 2
  • 5
  • 20