not a git repository Git Origin: Build & delivery OSI layer 7 · Application Last updated 13 Oct 2026

fatal: not a git repository (or any of the parent directories): .git

You ran a Git command outside a Git working tree.

Exact message you may see not a git repositorydetected dubious ownership in repository
Seen on: Git Docker

Meaning

Git searches the current directory and parents for .git. Not finding it means you’re in the wrong folder, the repo was never initialized, or .git was deleted.

Common causes

  • Wrong current directory
  • Repo not cloned/initialized
  • CI/Docker build context excludes .git (.dockerignore)
  • Ownership mismatch (detected dubious ownership on newer Git)

⚡ Quick fix

  1. cd into the project folder
  2. git init or clone the repo
  3. In CI, ensure checkout step ran; in Docker, don’t rely on git inside the image

Detailed fix by platform

Git

  1. For “dubious ownership”: git config --global --add safe.directory /path/to/repo.

How to diagnose

  1. Directory — pwd — right folder?
  2. .git — Does it exist?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Build & delivery. Errors that are often confused with or caused by this one (click to open):

adb server version doesn't match — adb server version (41) doesn't match this client (39); killing... (Android)adb server version do…author identity unknown — Author identity unknown *** Please tell me who you are. (Git)author identity unkno…aws: error: argument — aws: error: argument command: Invalid choice / Unknown options (AWS)aws: error: argumentcommand not found — bash: command not found (Linux)command not foundCOPY failed — COPY failed: file not found in build context / "/app/x": not found (Docker)COPY failedDefault FirebaseApp is not initialized — IllegalStateException: Default FirebaseApp is not initialized in this process (Android)Default FirebaseApp i…docker-compose: command not found — docker-compose: command not found / 'compose' is not a docker command (Docker)docker-compose: comma…ENOENT — npm ERR! enoent ENOENT: no such file or directory, open '/path/package.json' (npm)ENOENTnot a git…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.