From 0ed014bc91145fb672999e94cadf7d789166966d Mon Sep 17 00:00:00 2001 From: Dibir Magomedsaygitov <61747324+dibir-magomedsaygitov@users.noreply.github.com> Date: Fri, 22 Jan 2021 12:05:31 +0300 Subject: [PATCH] [Windows] Install Git using choco (#2473) * use choco to install git * remove ignore-dependencies for hub installation * debug --- images/win/scripts/Installers/Install-Git.ps1 | 33 +++---------------- 1 file changed, 4 insertions(+), 29 deletions(-) diff --git a/images/win/scripts/Installers/Install-Git.ps1 b/images/win/scripts/Installers/Install-Git.ps1 index e8954ffe5..db2eb3911 100644 --- a/images/win/scripts/Installers/Install-Git.ps1 +++ b/images/win/scripts/Installers/Install-Git.ps1 @@ -3,36 +3,11 @@ ## Desc: Install Git for Windows ################################################################################ -function getSimpleValue([string] $url, [string] $filename ) { - $fullpath = "${env:Temp}\$filename" - Invoke-WebRequest -Uri $url -OutFile $fullpath - $value = Get-Content $fullpath -Raw +# Install git +Choco-Install -PackageName git -ArgumentList '--installargs="/VERYSILENT /NORESTART /NOCANCEL /SP- /CLOSEAPPLICATIONS /RESTARTAPPLICATIONS /o:PathOption=CmdTools /o:BashTerminalOption=ConHost /o:EnableSymlinks=Enabled /COMPONENTS=gitlfs"' - return $value -} - -# Install the latest version of Git for Windows -$gitTag = getSimpleValue -url "https://gitforwindows.org/latest-tag.txt" -filename "gitlatesttag.txt" -$gitVersion = getSimpleValue -url "https://gitforwindows.org/latest-version.txt" -filename "gitlatestversion.txt"; - -$installerFile = "Git-$gitVersion-64-bit.exe"; -$downloadUrl = "https://github.com/git-for-windows/git/releases/download/$gitTag/$installerFile"; -Install-Binary -Url $downloadUrl ` - -Name $installerFile ` - -ArgumentList ( - "/VERYSILENT", ` - "/NORESTART", ` - "/NOCANCEL", ` - "/SP-", ` - "/CLOSEAPPLICATIONS", ` - "/RESTARTAPPLICATIONS", ` - "/o:PathOption=CmdTools", ` - "/o:BashTerminalOption=ConHost", ` - "/o:EnableSymlinks=Enabled", ` - "/COMPONENTS=gitlfs") - -# Install hub with --ignore-dependencies option to prevent the installation of the git package. See details in https://github.com/actions/virtual-environments/issues/2375 -Choco-Install -PackageName hub -ArgumentList "--ignore-dependencies" +# Install hub +Choco-Install -PackageName hub # Disable GCM machine-wide [Environment]::SetEnvironmentVariable("GCM_INTERACTIVE", "Never", [System.EnvironmentVariableTarget]::Machine)