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 <noreply@anthropic.com>