PlainError

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

Last checked 2026-10-26 · 4 fixes · reviewed answer

TL;DRGit cannot locate a repository because there is no .git folder in the current directory or any parent folder above it.

Most likely cause: The current working directory is not inside a Git repository

Try first: Check your current location (pwd)

Likely causes

  1. The current working directory is not inside a Git repositorymost likely
  2. The .git folder was deleted, moved, or never createdpossible
  3. You are running the command from the wrong folder or a fresh clone failed partwayless likely

How to fix it

Safest first: SafeChanges settingsDangerous
  1. Check your current locationSafe

    Run the command below to see the full path of the folder you are in.

    pwd
  2. List hidden files to look for .gitSafe

    Run the command below in the project folder to check if a .git directory exists.

    ls -a
  3. Navigate into the correct project folderSafe

    Use cd to move into the folder that contains your project files (replace path with the actual folder).

    cd /path/to/your/project
  4. Initialize a new repository if neededChanges settings

    Only do this if you are sure no repository should exist yet; this creates a fresh .git folder.

    git init

    ⚠ This starts a new repository and will not recover any previous history.

If that didn't fix it

Run 'git rev-parse --show-toplevel' from the project root to confirm the repository path.

When to see a technician

Consult a developer or IT support if the project files appear missing or you are unsure which folder should contain the repository.

Quick answers

What does fatal: not a git repository (or any of the parent directories): .git mean?
Git cannot locate a repository because there is no .git folder in the current directory or any parent folder above it.
What causes fatal: not a git repository (or any of the parent directories): .git?
The current working directory is not inside a Git repository. (most likely) The .git folder was deleted, moved, or never created. (possible) You are running the command from the wrong folder or a fresh clone failed partway. (less likely)
How do I fix fatal: not a git repository (or any of the parent directories): .git?
Try these in order, safest first: 1. Check your current location. 2. List hidden files to look for .git. 3. Navigate into the correct project folder. 4. Initialize a new repository if needed.
What if that didn't fix it?
Run 'git rev-parse --show-toplevel' from the project root to confirm the repository path.
When should I see a technician?
Consult a developer or IT support if the project files appear missing or you are unsure which folder should contain the repository.
Did this fix it? Report a problem

Related errors

All Coding errors →