Raphire / Win11Debloat

A simple, easy to use PowerShell script to remove pre-installed apps from Windows, disable telemetry, remove Bing from Windows search as well as perform various other changes to declutter and improve your Windows experience. This script works for both Windows 10 and Windows 11.
MIT License
12.88k stars 546 forks source link

Try to install git even if git has been installed #59

Closed lxl66566 closed 4 months ago

lxl66566 commented 4 months ago

The code does not actually check if git exists. (If git is not installed from winget)

Raphire commented 4 months ago

Heya,

WinGet actually checks if git is already installed, this even works in cases where WinGet was not used to install it. I just confirmed this behaviour on my windows 10 system that had git manually installed.

Have you run into issues with this?

lxl66566 commented 4 months ago

My git was installed by scoop: scoop install git. Winget did not detect it, and started to download:

C:\Users\lxl>where git
D:\scoop\shims\git.exe

C:\Users\lxl>git -v
git version 2.45.1.windows.1

C:\Users\lxl>winget -v
v1.7.11261

C:\Users\lxl>winget install git.git --accept-package-agreements --accept-source-agreements --disable-interactivity --no-upgrade
Found Git [Git.Git] Version 2.45.1
This application is licensed to you by its owner.
Microsoft is not responsible for, nor does it grant any licenses to, third-party packages.
Downloading https://github.com/git-for-windows/git/releases/download/v2.45.1.windows.1/Git-2.45.1-64-bit.exe
  █▊                              4.00 MB / 64.7 MB
Cancelled
Terminate batch job (Y/N)? Y

I tried on another PC that installed git by official installer, and winget does detect it. The difference may be that the installer writes package information to the Windows registry, but Scoop does not?

Raphire commented 4 months ago

Ooh interesting.

I'm guessing this is due to the fact that scoop installs apps in an unusual way, keeping them isolated in a scoop folder.

Seems like we'll need to manually check if git is installed after all! Thanks for bringing this to my attention 😃

Raphire commented 4 months ago

@lxl66566 This issue should now be resolved as of 9401de8. Could you please confirm on your end that it's now detecting git correctly?

lxl66566 commented 4 months ago

Yes, now it works well. Thank you!