From 2ab3888f56d06f455a06ed562b4a7fd56d8f2a92 Mon Sep 17 00:00:00 2001 From: "Zed A. Shaw" Date: Mon, 23 Dec 2024 11:38:18 -0500 Subject: [PATCH] I'm now forced to manually add git to the path myself. --- base.ps1 | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/base.ps1 b/base.ps1 index 7e1e7a0..dd068f9 100644 --- a/base.ps1 +++ b/base.ps1 @@ -225,7 +225,8 @@ $installs=@( 'Genivia.ugrep', 'Microsoft.WindowsTerminal', 'Kitware.CMake', - 'Microsoft.VCRedist.2015+.x64' + 'Microsoft.VCRedist.2015+.x64', + 'Git.Git' ) Write-Warning "About to install the following software:" @@ -240,11 +241,15 @@ foreach($pkg in $installs) { Start-Process -NoNewWindow -Wait winget -ArgumentList 'install',$pkg } -Write-Warning "!!!!!! GIT GIT GIT !!!!!" -Write-Warning "As of December 2024, my tests showed that git is not added to the path when you install it. I know, shocker right? I will attempt to install it interactively here. But if you cannot type 'git' in Terminal after you restart terminal then you will need to run: winget install git" -Read-Host -Prompt "Press any key to say you read the above" | Out-Null +$gitPath = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath("$env:APPDATA\..\Local\Programs\Git\cmd") -winget install -i Git.Git +if($env:PATH.contains($gitPath)) { + Write-Warning "!! Looks like your git installed correctly, but if it fails to run then uninstall it with 'winget remove git.git' then install it again with 'winget install git.git'" +} else { + Write-Warning "!! Git.Git did not add itself to the Path. The directory $gitPath is missing so I'll add it now." + $newPath = $Env:PATH + ";$gitPath" + [Environment]::SetEnvironmentVariable("Path", $newPath, "User") +} $winlibsPath = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath("$env:APPDATA\..\Local\Programs\WinLibs") @@ -277,5 +282,3 @@ if($env:PATH.contains($winlibsPath)) { $newPath = $Env:PATH + ";$winlibsPath\mingw64\bin" [Environment]::SetEnvironmentVariable("Path", $newPath, "User") } - -Write-Warning "!!! CLOSE THIS POWERSHELL AND START A NEW ONE TO UPDATE PATH!"