Chocolatey - Git installs, but is not on the PATH
Asked Answered
S

5

32

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?

Scyros answered 4/8, 2014 at 23:49 Comment(3)
Now type refreshenv (if you are in cmd.exe). Otherwise close and reopen shell. Native install goes to PATH, not to binLawton
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?Scyros
That could be the package OR the installer. In this case it is likely an issue with the package.Lawton
B
19

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

Bluebottle answered 27/3, 2015 at 16:43 Comment(0)
S
7

If you don't want to force a specific version:

Use --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

Please also check if you have administrative access requirements and that you have all windows permissions. Manual delete of previous installation files might help.

Suffuse answered 7/7, 2015 at 11:4 Comment(0)
B
5

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

Blowhole answered 5/8, 2014 at 6:8 Comment(2)
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!Scyros
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.<VERSIONNUMBER> directory and running the install again from admin shell fixed it all.Signorina
K
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.

Krystin answered 6/5, 2016 at 16:23 Comment(0)
A
1

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
Arenaceous answered 10/4, 2017 at 19:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.