From 5113d251a822f91becde6629627eeb293107b3b5 Mon Sep 17 00:00:00 2001 From: Alexey-Ayupov <116575425+Alexey-Ayupov@users.noreply.github.com> Date: Mon, 20 May 2024 16:44:16 +0200 Subject: [PATCH] [Windows] Add new git environment variable (#9898) --- images/windows/scripts/build/Install-Git.ps1 | 2 ++ images/windows/scripts/tests/Git.Tests.ps1 | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/images/windows/scripts/build/Install-Git.ps1 b/images/windows/scripts/build/Install-Git.ps1 index 21648cef4..4c8cbb8c4 100644 --- a/images/windows/scripts/build/Install-Git.ps1 +++ b/images/windows/scripts/build/Install-Git.ps1 @@ -41,6 +41,8 @@ if ($LASTEXITCODE -ne 0) { # Disable GCM machine-wide [Environment]::SetEnvironmentVariable("GCM_INTERACTIVE", "Never", "Machine") +# Revert to the old behaviour and avoid the Git LFS problems (https://github.blog/2024-05-14-securing-git-addressing-5-new-vulnerabilities/) +[Environment]::SetEnvironmentVariable("GIT_CLONE_PROTECTION_ACTIVE", "false", "Machine") # Add to PATH Add-MachinePathItem "C:\Program Files\Git\bin" diff --git a/images/windows/scripts/tests/Git.Tests.ps1 b/images/windows/scripts/tests/Git.Tests.ps1 index 00b3d2302..87ef9b55e 100644 --- a/images/windows/scripts/tests/Git.Tests.ps1 +++ b/images/windows/scripts/tests/Git.Tests.ps1 @@ -22,4 +22,8 @@ Describe "Git" { It "GCM_INTERACTIVE environment variable should be equal Never" { $env:GCM_INTERACTIVE | Should -BeExactly Never } + + It "GIT_CLONE_PROTECTION_ACTIVE environment variable should be equal false" { + $env:GIT_CLONE_PROTECTION_ACTIVE | Should -BeExactly false + } }