[Windows] Install git from gh (#6427)

* Install Git from GitHub

* get installer file name
This commit is contained in:
Aleksandr Chebotov
2022-10-19 20:27:55 +02:00
committed by GitHub
parent 1bbdd25a22
commit 842c43d557

View File

@@ -4,15 +4,32 @@
################################################################################ ################################################################################
Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1" Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
# Install git # Install the latest version of Git for Windows
Choco-Install -PackageName git -ArgumentList '--installargs="/VERYSILENT /NORESTART /NOCANCEL /SP- /CLOSEAPPLICATIONS /RESTARTAPPLICATIONS /o:PathOption=CmdTools /o:BashTerminalOption=ConHost /o:EnableSymlinks=Enabled /COMPONENTS=gitlfs"' $gitReleases = Invoke-RestMethod "https://api.github.com/repos/git-for-windows/git/releases/latest"
[string]$downloadUrl = $gitReleases.assets.browser_download_url -match "Git-.+-64-bit.exe"
$installerFile = Split-Path $downloadUrl -Leaf
Install-Binary -Url $downloadUrl `
-Name $installerFile `
-ArgumentList (
"/VERYSILENT", `
"/NORESTART", `
"/NOCANCEL", `
"/SP-", `
"/CLOSEAPPLICATIONS", `
"/RESTARTAPPLICATIONS", `
"/o:PathOption=CmdTools", `
"/o:BashTerminalOption=ConHost", `
"/o:EnableSymlinks=Enabled", `
"/COMPONENTS=gitlfs")
Update-SessionEnvironment Update-SessionEnvironment
git config --system --add safe.directory "*" git config --system --add safe.directory "*"
# Install hub # Install hub with --ignore-dependencies option to prevent the installation of the git package.
Choco-Install -PackageName hub # See details in https://github.com/actions/runner-images/issues/2375
Choco-Install -PackageName hub -ArgumentList "--ignore-dependencies"
# Disable GCM machine-wide # Disable GCM machine-wide
[Environment]::SetEnvironmentVariable("GCM_INTERACTIVE", "Never", [System.EnvironmentVariableTarget]::Machine) [Environment]::SetEnvironmentVariable("GCM_INTERACTIVE", "Never", [System.EnvironmentVariableTarget]::Machine)