[git] "fatal: Not a git repository (or any of the parent directories)" from git status

This command works to get the files and compile them:

git clone a-valid-git-url

for example:

git clone git://cfdem.git.sourceforge.net/gitroot/cfdem/liggghts

However, git status (or any other git command) then gives the above fatal: Not a git repository (or any of the parent directories) error.

What am I doing wrong?

This question is related to git repository clone git-clone git-status

The answer is


git clone https://github.com/klevamane/projone.git
Cloning into 'projone'...
remote: Counting objects: 81, done.
remote: Compressing objects: 100% (66/66), done.
remote: Total 81 (delta 13), reused 78 (delta 13), pack-reused 0
Unpacking objects: 100% (81/81), done.

you have to "cd projone"

then you can check status.


One reason why this was difficult to notice at first, i because you created a folder with the same name already in your computer and that was where you cloned the project into, so you have to change directory again



If Existing Project Solution is planned to move on TSF in VS Code:

open Terminal and run following commands:

  1. Initialize git in that folder (root Directory)

    git init

  2. Add Git

    git add .

  3. Link your TSf/Git to that Project - {url} replace with your git address

    git remote add origin {url}

  4. Commit those Changes:

    git commit -m "initial commit"

  5. Push - I pushed code as version1 you can use any name for your branch

    git push origin HEAD:Version1


In my case, the original repository was a bare one.

So, I had to type (in windows):

mkdir   dest
cd dest
git init
git remote add origin a\valid\yet\bare\repository
git pull origin master

To check if a repository is a bare one:

git rev-parse --is-bare-repository 

Sometimes its because of ssh. So you can use this:

git clone https://cfdem.git.sourceforge.net/gitroot/cfdem/liggghts

instead of:

git clone git://cfdem.git.sourceforge.net/gitroot/cfdem/liggghts

In my case, was an environment variable GIT_DIR, which I added to access faster.

This also broke all my local repos in SourceTree :(


I had another problem. I was in a git directory, but got there through a symlink. I had to go into the directory directly (i.e. not through the symlink) then it worked fine.


I suddenly got an error like in any directory I tried to run any git command from:

fatal: Not a git repository: /Users/me/Desktop/../../.git/modules/some-submodule

For me, turned out I had a hidden file .git on my Desktop with the content:

gitdir: ../../.git/modules/some-module

Removed that file and fixed.


in my case, i had the same problem while i try any git -- commands (eg git status) using windows cmd. so what i do is after installing git for window https://windows.github.com/ in the environmental variables, add the class path of the git on the "PATH" varaiable. usually the git will installed on C:/user/"username"/appdata/local/git/bin add this on the PATH in the environmental variable

and one more thing on the cmd go to your git repository or cd to where your clone are on your window usually they will be stored on the documents under github

cd Document/Github/yourproject

after that you can have any git commands


I just got this message and there is a very simple answer before trying the others. At the parent directory, type git init

This will initialize the directory for git. Then git add and git commit should work.


This error got resolved when I tried initialising the git using git init . It worked


i have the same problem from my office network. i use this command but its not working for me url, so like this: before $ git clone https://gitlab.com/omsharma/Resume.git

After i Use this URL : $ git clone https://[email protected]/omsharma/Resume.git try It.


Simply, after you clone the repo you need to cd (change your current directory) to the new cloned folder

git clone https://[email protected]/Repo_Name.git

cd Repo_Name

Examples related to git

Does the target directory for a git clone have to match the repo name? Git fatal: protocol 'https' is not supported Git is not working after macOS Update (xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools) git clone: Authentication failed for <URL> destination path already exists and is not an empty directory SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443 GitLab remote: HTTP Basic: Access denied and fatal Authentication How can I switch to another branch in git? VS 2017 Git Local Commit DB.lock error on every commit How to remove an unpushed outgoing commit in Visual Studio?

Examples related to repository

Kubernetes Pod fails with CrashLoopBackOff Project vs Repository in GitHub How to manually deploy artifacts in Nexus Repository Manager OSS 3 How to return a custom object from a Spring Data JPA GROUP BY query How do I force Maven to use my local repository rather than going out to remote repos to retrieve artifacts? How do I rename both a Git local and remote branch name? Can't Autowire @Repository annotated interface in Spring Boot How should I deal with "package 'xxx' is not available (for R version x.y.z)" warning? git repo says it's up-to-date after pull but files are not updated Transfer git repositories from GitLab to GitHub - can we, how to and pitfalls (if any)?

Examples related to clone

git clone error: RPC failed; curl 56 OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 10054 git: fatal: I don't handle protocol '??http' How to make a copy of an object in C# How create a new deep copy (clone) of a List<T>? "fatal: Not a git repository (or any of the parent directories)" from git status How to copy java.util.list Collection How to jQuery clone() and change id? Copying a HashMap in Java jquery clone div and append it after specific div jQuery Clone table row

Examples related to git-clone

Git: Permission denied (publickey) fatal - Could not read from remote repository. while cloning Git repository git clone from another directory How to git clone a specific tag fatal: could not create work tree dir 'kivy' Unable to Connect to GitHub.com For Cloning Is it possible to find out the users who have checked out my project on GitHub? BitBucket - download source as ZIP "fatal: Not a git repository (or any of the parent directories)" from git status Git clone without .git directory How to get Git to clone into current directory

Examples related to git-status

Git list of staged files "fatal: Not a git repository (or any of the parent directories)" from git status Git: list only "untracked" files (also, custom commands) How to resolve git status "Unmerged paths:"? git status shows modifications, git checkout -- <file> doesn't remove them