From 83fa442c1bf782ba6a43c99da6909ee45a306e04 Mon Sep 17 00:00:00 2001 From: teknium1 Date: Mon, 2 Mar 2026 22:47:04 -0800 Subject: [PATCH] fix: use env vars for git windows.appendAtomically on Windows The previous fix set git config --global before clone, but on systems where atomic writes are broken (OneDrive, antivirus, NTFS filter drivers), even writing ~/.gitconfig fails with 'Invalid argument'. Fix: inject the config via GIT_CONFIG_COUNT/KEY/VALUE environment variables, which git reads before performing any file I/O. This bypasses the chicken-and-egg problem where git can't write the config file that would fix its file-writing issue. --- scripts/install.ps1 | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/scripts/install.ps1 b/scripts/install.ps1 index aec1b5e69..9f6ee3db4 100644 --- a/scripts/install.ps1 +++ b/scripts/install.ps1 @@ -427,10 +427,17 @@ function Install-Repository { } } else { # Fix Windows git "copy-fd: write returned: Invalid argument" error. - # Must be set BEFORE clone, otherwise git fails copying hook templates. - # Also fixes "unable to write loose object file" for later operations. + # Git for Windows can fail on atomic file operations (hook templates, + # config lock files) due to antivirus, OneDrive, or NTFS filter drivers. + # Setting windows.appendAtomically=false via ENVIRONMENT bypasses the + # issue entirely — git reads these before touching any files, unlike + # --global config which itself may fail to write. Write-Info "Configuring git for Windows compatibility..." - git config --global windows.appendAtomically false + $env:GIT_CONFIG_COUNT = "1" + $env:GIT_CONFIG_KEY_0 = "windows.appendAtomically" + $env:GIT_CONFIG_VALUE_0 = "false" + # Also try global config (may fail but harmless) + git config --global windows.appendAtomically false 2>$null # Try SSH first (for private repo access), fall back to HTTPS. # GIT_SSH_COMMAND with BatchMode=yes prevents SSH from hanging