fatal: not a git repository (or any of the parent directories): .git
You ran a Git command outside a Git working tree.
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 ownershipon newer Git)
⚡ Quick fix
cdinto the project foldergit initor clone the repo- In CI, ensure checkout step ran; in Docker, don’t rely on git inside the image
Detailed fix by platform
Git
- For “dubious ownership”:
git config --global --add safe.directory /path/to/repo.
How to diagnose
- Directory —
pwd— right folder? - .git — Does it exist?
🧠 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.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026