mirror of
https://github.com/actions/runner-images-sangeeth.git
synced 2025-12-20 06:29:50 +00:00
We only offer Windows environments that support symbolic links, meaning: if running either as administrator, or with Windows' Developer Mode enabled, symbolic links can be created. However, Git for Windows' auto-detection assumes that if it is installed by an administrator, it cannot detect whether "regular" users can create symbolic links, and by way of playing it safe, disables symlink support. Since we know better, we can avoid the auto-detection.
44 lines
1.6 KiB
PowerShell
44 lines
1.6 KiB
PowerShell
################################################################################
|
|
## File: Install-Git.ps1
|
|
## Desc: Install Git for Windows
|
|
################################################################################
|
|
|
|
Import-Module -Name ImageHelpers
|
|
|
|
function getSimpleValue([string] $url, [string] $filename ) {
|
|
$fullpath = "${env:Temp}\$filename"
|
|
Invoke-WebRequest -Uri $url -OutFile $fullpath
|
|
$value = Get-Content $fullpath -Raw
|
|
|
|
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")
|
|
|
|
Choco-Install -PackageName hub
|
|
|
|
# Disable GCM machine-wide
|
|
[Environment]::SetEnvironmentVariable("GCM_INTERACTIVE", "Never", [System.EnvironmentVariableTarget]::Machine)
|
|
|
|
Add-MachinePathItem "C:\Program Files\Git\bin"
|
|
|
|
exit 0
|