Git's 'dubious ownership' error in containers traces back to a 2022 security fix

A developer running an AI coding agent in a container with a non-root user sees Git refuse to run, reporting dubious ownership of the bind-mounted repository. The cause is a mismatch between the numeric user IDs of the host and the container, which Git checks to prevent exploitation. Git's check stems from CVE-2022-24765, which allowed a malicious .git directory planted in a parent folder to execute commands when a user ran Git in a nearby directory. Setting safe.directory to a wildcard silences the error but disables that protection, so the article recommends adding only the specific path. The behavior can differ on macOS and Windows because Docker Desktop handles bind mounts differently.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in