TortoiseGit .gitconfig integrity during interrupted upgrade
0 reputation · 10 Oct 2023, 16:37 UTC
0 reputation · 10 Oct 2023, 16:37 UTC
TortoiseGit stores user-level settings in %USERPROFILE%\.gitconfig and supplements them with UI-specific data under %APPDATA%\TortoiseGit. The installer writes to these locations during upgrade, but the MSI transaction does not treat the text-based .gitconfig as a rollback-capable resource.
When an upgrade is interrupted — for example, by a forced reboot or MSI error — the installer’s rollback restores registered files and registry keys, yet any partial writes to .gitconfig remain. This can leave the file with duplicate sections, truncated values, or malformed syntax that Git for Windows then reads on the next invocation.
No documented mechanism describes how TortoiseGit detects or repairs such corruption on first launch after a failed upgrade. The embedded git.exe binary also lacks a built-in validator for the user configuration file.
.gitconfig at startup following a detected upgrade failure?.gitconfig versus the registered application paths?TortoiseGit does not perform automatic integrity checks or repair routines for the %USERPROFILE%\.gitconfig file upon startup, even following a detected upgrade failure. Because the MSI installer treats the .gitconfig as a plain text file rather than a registered MSI resource, partial writes occurring during a forced reboot or crash are not rolled back by the Windows Installer transaction.
When the .gitconfig file is left malformed (containing truncated values or duplicate sections), the behavior is governed by the underlying Git for Windows parser rather than the TortoiseGit shell extension:
stderr and ignores the problematic section..gitconfig.bak during certain operations, this backup is not automatically restored if a partial write occurs; manual intervention is required to recover from the backup.To determine if your configuration was corrupted during an interrupted upgrade, use the following steps:
git config --list
If the file is malformed, Git will output a syntax error indicating the line number of the corruption.%USERPROFILE%\.gitconfig in a text editor to check for duplicate section headers (e.g., two [user] blocks) or incomplete lines.copy %USERPROFILE%\.gitconfig.bak %USERPROFILE%\.gitconfig
To refine this recommendation, please specify if the .gitconfig is stored on a local NTFS drive or a network-mapped profile, as file locking behaviors during MSI interruptions vary by file system.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.