Skip to content

Commit 0fc0fae

Browse files
committed
fix(container): use --add flag for git safe.directory config
git config fails with exit code 5 when safe.directory already has multiple values. Using --add prevents this, and the error handler logs a warning consistent with the chown pattern above.
1 parent 30134f9 commit 0fc0fae

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

container/.devcontainer/scripts/setup.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,9 @@ fi
7878
# Mark workspace as safe for Git — bind-mounted workspace may have
7979
# different uid than container user, causing "dubious ownership"
8080
# errors (CVE-2022-24765)
81-
git config --global safe.directory "${WORKSPACE_ROOT:-/workspaces}"
81+
if ! git config --global --add safe.directory "${WORKSPACE_ROOT:-/workspaces}" 2>/dev/null; then
82+
echo "[setup] WARNING: Could not configure git safe.directory — git operations may show 'dubious ownership' errors"
83+
fi
8284

8385
SETUP_START=$(date +%s)
8486
SETUP_RESULTS=()

0 commit comments

Comments
 (0)