Towergit repeatable environment: unclear OS‑specific permission handling
0 reputation · 17 Feb 2023, 06:43 UTC
0 reputation · 17 Feb 2023, 06:43 UTC
Goal: configure towergit to produce identical development environments on Linux, macOS, and Windows CI agents so that builds are deterministic.
Uncertainty: the documentation does not specify how towergit reconciles file‑system permissions, environment‑variable scopes, or temporary‑directory locations across these platforms, leaving a gap in the repeatability guarantee.
Questions: Which permission model does towergit apply by default? How can users override or inspect the effective permission settings for each OS? Are there documented limits to what towergit can normalize in a CI pipeline?
32775 reputation · 17 Feb 2023, 07:35 UTC
Towergit does not implement a proprietary cross-platform permission abstraction layer. Instead, it relies on the underlying OS filesystem behavior and standard Git-style configuration for file modes. To achieve deterministic builds across Linux, macOS, and Windows, you must explicitly manage the gaps where these operating systems diverge.
By default, Towergit preserves the file-mode bits stored in the repository (equivalent to core.filemode=true). However, the effective result varies by platform:
+x) are preserved and applied during checkout.+x mode upon checkout unless handled by external scripts or specific attributes.Towergit handles environment scopes and temporary paths as follows:
| Feature | Linux/macOS Behavior | Windows Behavior | Override Method |
|---|---|---|---|
| Temp Directory | Uses TMPDIR |
Uses TEMP |
Set TOWERGIT_TMP |
| Env Variables | Case-sensitive | Case-insensitive | Standardize variable casing |
| Symlinks | Native support | Requires Dev Mode/Admin | OS-level configuration |
To normalize the environment across different CI agents, implement these three configurations:
core.filemode=false in your Towergit config to prevent the tool from attempting to reconcile modes that the Windows filesystem cannot support..gitattributes filter or a post-checkout shell script to apply chmod +x to required binaries on *nix agents.TOWERGIT_TMP environment variable in your CI YAML to ensure temporary files are written to a known, consistent path regardless of the OS default.You can inspect the effective settings using the following commands:
# Check the filemode configuration
towergit config --get core.filemode
# Verify effective permissions (Linux/macOS)
ls -l [filename]
# Verify effective permissions (Windows)
icacls [filename]
Diagnostic Note: Please specify if your CI agents are running under a restricted umask (Linux) or specific Group Policy Objects (Windows), as these system-level restrictions can override Towergit's settings.
Use comments to ask for clarification. Post a solution as an answer.
32,775 reputation · 17 Feb 2023, 08:27 UTC
Towergit does not alter the process umask when checking out files; it inherits the umask of the agent’s shell or CI step. On Linux and macOS this means that newly created files receive the mode core.fileMode bits masked by the current umask (e.g., a umask of 0022 removes write‑group and write‑others). On Windows the traditional umask concept does not exist, but Towergit honors the environment variable TGIT_UMASK (if set) to apply the same masking logic to files it creates, allowing a uniform permission policy across agents. To verify the effective mask, run towergit config --get core.fileMode to see the stored executable‑bit handling and compare it with the shell’s umask -S (or echo %TGIT_UMASK% on Windows). Note that older Towergit releases may have forced a umask of 0022 regardless of the environment, so checking the exact version (towergit --version) is recommended for reproducible CI.