fatal: not a git repository
Git searched this folder and every folder above it and found no repository, so the command has nothing to work on.
Also appears as
- fatal: not a git repository (or any parent up to mount point /) Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
Prompt to fix it
Git says "fatal: not a git repository (or any of the parent directories): .git". Check which folder the command runs in and whether this project already has a .git folder or a GitHub repository. If we’re in the wrong folder, switch to the right one. If the files came from a ZIP or export of an existing GitHub repo, clone that repo and bring my changes into the clone. Only run git init for a brand-new project, and show me the commands before you add a remote or push.
Paste into Layerwise or any AI coding tool.
What it means
A git repository is a project folder with a hidden .git folder inside, which holds the history. Every git command starts in the current folder and walks up through the parent folders looking for .git. This error means it reached the top without finding one.
Usually the terminal is simply in the wrong place: your home folder, a parent folder, or a different project. Downloaded projects are the other common case. A ZIP download from GitHub, or an export from an AI builder, contains the files without the hidden .git folder, so it has no history and no link to the GitHub repository.
Running git init makes the message go away but starts a brand-new, empty history. If the project already lives on GitHub, clone it and copy your changed files into the clone. Otherwise the two histories share no commits, and your first push gets rejected. In Docker and CI, the “filesystem boundary” variant usually means .git wasn’t copied into the container.
Common causes
- The terminal is in the wrong folder, such as your home folder or the folder above the project.
- The project came from a ZIP download or export, which leaves out the hidden
.gitfolder. - The project was created locally and never put under git.
- A Docker build or CI step runs git, but
.dockerignoreor the checkout step left.gitout.
How to fix it
- Run
pwdto see where you are (cdwith no arguments in Windows Command Prompt), thencdinto the project folder that containspackage.json. - Run
git statusagain. If it works, you were in the wrong folder. - If the project is already on GitHub, run
git clone https://github.com/acme/my-app.gitand work in that folder. - If it’s a new project, check that
.gitignorelistsnode_modulesand.env, then rungit init, commit, and connect it to an empty GitHub repository. - In Docker or CI, keep
.gitin the build context, or pass values like the commit hash in as build arguments.
Example fix
# Where am I, and is there a .git folder here?
pwd
ls -a
# New project only. Check .gitignore lists node_modules and .env first.
git init
git add .
git commit -m "First commit"
git branch -M main
git remote add origin https://github.com/acme/my-app.git
git push -u origin mainRelated errors
All errorsFailed to push some refs
GitHub has commits your copy doesn’t, so git refused to overwrite them until you bring those changes in.
vite: command not found
The shell couldn’t find the vite program, almost always because the project’s packages aren’t installed or the command ran in the wrong folder.
CONFLICT (content): Merge conflict
Both versions changed the same lines in different ways, and git needs you to decide what the file should say before it finishes.
GH013: Push cannot contain secrets
GitHub found an API key or other secret in the commits you tried to push and blocked the whole push so the secret wouldn’t land in the repository.
Build with an agent that checks its work
The Layerwise agent clicks through the live preview and reads the console, so it catches errors before you do.