Git dubious-ownership Git refused to run because the repository folder is owned by a different system user.

dev@local: ~/project — git
dev@local~/project$git status
fatal: dubious ownership
To add an exception for this directory, call:
git config --global --add safe.directory /project
Diagnostics Translation
Git refused to run because the repository folder is owned by a different system user.
waiting for resolution...
MediumVersion Control System

Reviewed for reference consistency: August 11, 2026

Data Loss Risk

HIGH RISK

Git stopped to prevent overriding unsaved work. Do not force commands without stashing or committing first.

What To Know

This state means Git sees a filesystem ownership mismatch large enough to treat the repository as untrusted until the directory is explicitly accepted.

Where Did It Fail?

Working Tree
Your local files
add
Staging Index
Prepared changes
commit
Local Repo
Commit history
push/fetch
Remote Server
GitHub/GitLab
Git halted to protect the uncommitted files in your active working directory.

Commands That Trigger This

Opening a project in VS Code via WSL and finding that Git integration is completely broken
A CI/CD pipeline script failing when a Docker container tries to check out code
A provisioning or build step that ran as root created the checkout, and the developer's own shell now fails every Git command
A scheduled job or web application running Git under a service account against a developer's working copy

Technical Background

01

If an attacker can place a malicious `.git/config` file in a shared directory, they could trick your Git client into executing arbitrary commands with your user privileges.

02

Git enforces this check globally. If the ownership mismatch is intentional (like in Docker/WSL setups), the directory must be explicitly added to the `safe.directory` config list.

03

Where the exception is set matters as much as the exception itself. `safe.directory` is only honored in protected configuration — system, global, or command-line scope — because a repository must not be able to vouch for itself; an entry in the repo's own `.git/config` is ignored. Matching is by exact normalized path, so a value that differs in slashes or spelling has no effect.

04

Two details cover most edge cases. On non-Windows platforms, Git running under `sudo` also accepts the original user's ID recorded in `SUDO_UID`, so a repository you own usually still works when briefly operated as root. The wildcard value `*` disables the check entirely, and a directory with `/*` appended trusts every repository underneath it.

Underlying Causes

Running Git inside a Docker container mounted to a host directory
Using WSL (Windows Subsystem for Linux) on a Windows NTFS file system
Running a Git command using `sudo` or as the `root` user
A web app, cron job, or CI runner executing Git under a service account that does not own the checkout

Frequently Asked Questions

Only if you completely trust the directory and the users who have write access to it (e.g., it is your own local development environment).

The check compares accounts, not file health: whoever owns the `.git` directory counts, and Git stops before reading anything inside it. It shipped with the 2.35.2 security fix so configs planted by another user are never read in the first place.

The asterisk turns the check off for every repository that account touches, which is defensible only on machines where no untrusted user can plant files. Listing the specific directory, or a directory with `/*` appended, keeps the boundary on shared machines.

Git accepts this setting only from protected configuration — system, global, or command-line scope — so an entry inside `.git/config` is silently ignored. Ask Git to print each definition with its scope before trusting one.

Updated clients carry the 2.35.2 ownership check, so repositories that mixed owners before — cron jobs, root-run builds, shared checkouts — simply started failing on the first command the new Git ran.

Related Git States