Git Fatal: detected dubious ownership in repository (CVE-2022-24765)

Repository directory is owned by a different UID than the user running `git` (common in Docker/CI).

Runs locally in browser Free · No login Independently Verified 2026-11-25 v4.1.0
Identifier: Git Fatal Platform: Git
Common Root Causes:
  • Repository directory is owned by a different UID than the user running `git` (common in Docker/CI).

Interactive Diagnostic Checklist

Verified Solutions:
  1. Fix directory ownership (`chown -R`) or explicitly trust path via `git config --global --add safe.directory <path>`.
Safe Diagnostic Command:
ls -ld .git && id
Warning: Verify configuration changes in staging or with dry-run flags (e.g. nginx -t) before reloading production services.

Technical Explanation

Repository directory is owned by a different UID than the user running `git` (common in Docker/CI). Recommended diagnostic: `ls -ld .git && id`. Remediation: Fix directory ownership (`chown -R`) or explicitly trust path via `git config --global --add safe.directory <path>`.

Worked Examples

  • Run `ls -ld .git && id` to verify root cause before applying the remediation.

Limitations & Assumptions

  • Always verify configuration changes in staging or with dry-run flags (e.g. `nginx -t`) before reloading production services.

Source References & Verification

Resource ID: err-git-dubious-ownership-safe-directory · Independently verified: 2026-11-25

Related Resources