From 70e74ab2d2a30e9d5de6e614ba1c80f3f27462c6 Mon Sep 17 00:00:00 2001 From: DevContainer User Date: Wed, 11 Mar 2026 16:47:30 +0000 Subject: [PATCH] fix(init-repo): create $HOME before git config on fresh volumes git config --global writes to $HOME/.gitconfig, but on a fresh PVC $HOME (/config/userdata) doesn't exist yet. This causes the script to fail with "could not lock config file" and exit due to set -e, leaving the container in a crash loop with a black screen. Move the mkdir -p $HOME + chown to the top of the script so it runs before any git operations. Co-Authored-By: Claude Opus 4.6 --- scripts/init-repo.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/scripts/init-repo.sh b/scripts/init-repo.sh index 34f44cb..b06de61 100644 --- a/scripts/init-repo.sh +++ b/scripts/init-repo.sh @@ -4,6 +4,13 @@ set -e echo "=== Repository Initialization ===" +# Ensure home directory exists on the PVC before any git operations +# (git config --global writes to $HOME/.gitconfig, which fails on a fresh volume) +RUN_UID="${USER_ID:-1000}" +RUN_GID="${GROUP_ID:-1000}" +mkdir -p "$HOME" +chown "$RUN_UID:$RUN_GID" "$HOME" + # Set up basic git configuration echo "Configuring git user settings..." # Use environment variables if provided, otherwise use defaults @@ -142,10 +149,6 @@ if [ ${#REPOS[@]} -eq 0 ]; then chown -R "$RUN_UID:$RUN_GID" "$WORKSPACE_DIR" fi -# Ensure home directory exists on the PVC (may be absent on a fresh volume) -mkdir -p "$HOME" -chown "$RUN_UID:$RUN_GID" "$HOME" - # Seed Claude Code settings if missing (disable auto-updater in Docker) if [ ! -f "$HOME/.claude/settings.json" ]; then mkdir -p "$HOME/.claude"