-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathgit-scm.ps1
41 lines (30 loc) · 951 Bytes
/
git-scm.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
Function Install-Git {
[CmdletBinding()]
param()
BEGIN {
$address = "https://github.com/git-for-windows/git/releases/download/v2.36.0.windows.1/Git-2.36.0-64-bit.exe"
$exe = "$Env:TEMP\git-scm.exe"
}
PROCESS {
Invoke-RestMethod `
-Method Get `
-Uri $address `
-OutFile $exe
Write-Host "Installing Git. Please wait..." -ForegroundColor Cyan
$job = Start-Job `
-ArgumentList $exe `
-ScriptBlock {
param([string]$exe)
## https://github.com/git-for-windows/git/wiki/Silent-or-Unattended-Installation
$options = "gitlfs,assoc,assoc_sh,windowsterminal"
$expression = ". `"$($exe)`" /VERYSILENT /NORESTART /NOCANCEL /SP- /CLOSEAPPLICATIONS /RESTARTAPPLICATIONS /COMPONENTS=`"$options`" "
Write-Host $expression
Invoke-Expression -Command $expression
[Threading.Thread]::Sleep(50000)
}
Wait-Job $job
Receive-Job $job
Remove-Job $job
}
}
Install-Git