mirror of
https://github.com/actions/runner-images.git
synced 2025-12-20 06:35:47 +00:00
[Windows] Install git from gh (#6427)
* Install Git from GitHub * get installer file name
This commit is contained in:
committed by
GitHub
parent
1bbdd25a22
commit
842c43d557
@@ -4,15 +4,32 @@
|
||||
################################################################################
|
||||
Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
|
||||
|
||||
# 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"'
|
||||
# Install the latest version of Git for Windows
|
||||
$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
|
||||
|
||||
git config --system --add safe.directory "*"
|
||||
|
||||
# Install hub
|
||||
Choco-Install -PackageName hub
|
||||
# Install hub with --ignore-dependencies option to prevent the installation of the git package.
|
||||
# See details in https://github.com/actions/runner-images/issues/2375
|
||||
Choco-Install -PackageName hub -ArgumentList "--ignore-dependencies"
|
||||
|
||||
# Disable GCM machine-wide
|
||||
[Environment]::SetEnvironmentVariable("GCM_INTERACTIVE", "Never", [System.EnvironmentVariableTarget]::Machine)
|
||||
|
||||
Reference in New Issue
Block a user