TortoiseGit and Git for Windows: Global git.exe Path Limits with Multiple Distributions
0 reputation · 09 Sept 2020, 18:46 UTC
0 reputation · 09 Sept 2020, 18:46 UTC
TortoiseGit acts as a Windows Explorer shell extension and GUI front end, delegating all repository operations to an external git.exe. On machines where Git for Windows coexists with other distributions such as MSYS2 or portable builds, the integration boundary becomes the global Git.exe path setting. Because TortoiseGit does not bundle Git, the installer and Settings dialog rely on registry entries written by the Git for Windows setup to auto-detect a supported binary. Unregistered distributions remain invisible to that detection, forcing a manual path that applies to every repository opened by that TortoiseGit installation.
The unresolved design tension is that a single TortoiseGit instance cannot bind different working copies to different Git toolchains. Changing the configured path affects all repositories simultaneously and may require an Explorer restart to take effect consistently. There is also ambiguity about precedence: if another Git appears earlier in PATH, or if Git for Windows is relocated, operations may fail with generic dialogs or path-translation errors rather than a clear mismatch message. TortoiseGit release notes describe supported Git version ranges, but the boundary is not enforced at runtime.
Given these constraints, what is the intended workflow for teams that need both a registered Git for Windows install and an unregistered portable or MSYS2 Git on the same workstation? Should the global path be treated as a machine-level invariant, or are there supported mechanisms to isolate toolchain selection per project? Where does the boundary between TortoiseGit's configured path and the system PATH environment variable become observable during repository operations?
Treat the global git.exe path as a machine‑level invariant that points to the registered Git for Windows installation. For repositories that need a different distribution (portable Git, MSYS2, or another build), set a per‑repository override in the working copy’s .tgitconfig file. TortoiseGit checks the override first, then the global registry value, and finally falls back to the first git.exe found in the system PATH.
C:\\Program Files\\Git\\bin\\git.exe).HKCU\\Software\\TortoiseGit\\GitPath.git.exe (e.g., D:\\PortableGit\\bin\\git.exe)..tgitconfig file.git.exe..tgitconfig file; it should contain a section like:
[TortoiseGit]
gitPath = D:\\PortableGit\\bin\\git.exe
GitPath temporarily; the repository should still use the portable Git, while other repos fall back to PATH or fail if no Git is found.The boundary between the configured path and the system PATH becomes visible when TortoiseGit launches the external git.exe. If a per‑repository gitPath is set, that exact binary is used regardless of PATH. If the setting is empty, TortoiseGit queries the environment variable PATH and executes the first matching git.exe it finds. Changing the global registry value requires a restart of Windows Explorer (or logoff/logon) for the shell extension to pick up the new path; per‑repo changes take effect immediately for that repository.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.