Winget doesn't automatically adds a Git environment variable after installing Git in Windows 11
Description of the new feature / enhancement
When executing the following command
winget install -e --id Git.Git , the latest version of Git is installed but no git command can be executed because the environment variable PATH is not modified to include the Git installation folder.
Proposed technical implementation details
We can choose to modify the PATH variable and append the Git installation folder to enhance the user experience.
Related to:
- https://github.com/microsoft/winget-cli/issues/2781
- https://github.com/microsoft/winget-cli/issues/2521
- https://github.com/microsoft/winget-pkgs/issues/62326
We're looking at another issue related to environment variables like "Path" that don't get refreshed in an active session. If a package has a dependency on another one and it needs to be on the path for the "primary" package to install, the primary package will fail.
In your particular example, if you close the "terminal" and re-open to get the environment variables updated, are you able to call git?
Thanks for replying. Nope, even after restarting the terminal (and in my case, the machine) doesn't add the appropriate git executable to the PATH env.
I haven't encountered this issue or been able to reproduce it. The "installer" is responsible for adding Path entries. WinGet only adds portable (and in the next version .zip based portable) packages to the path. If you perform a "manual" uninstall and then run winget install git.git does it still not add the path entry?
If no, which version of git.git was installed, and can you share the logs?
The log location is visible via winget info as well as the version of WinGet and the architecture. That information could also be helpful. There is also an experimental feature in preview versions that can be enabled to add "--open-logs" to the command which will open the log directory if the feature is enabled.
Example PR:
- https://github.com/microsoft/winget-pkgs/pull/90517
Related Issue:
- https://github.com/microsoft/winget-cli/issues/2939
Duplicate of #222
@protyay we've identified this Issue as a duplicate of another one that already exists. This specific instance is being closed in favor of tracking the concern over on the referenced Issue. Thanks for your report! Be sure to add your 👍 to the other issue to help raise the priority.
@protyay we've identified this Issue as a duplicate of another one that already exists. This specific instance is being closed in favor of tracking the concern over on the referenced Issue. Thanks for your report! Be sure to add your 👍 to the other issue to help raise the priority.