Git Clone Repo Has No .git File

13k Views Asked by At

I cloned a repo with git clone <path to repo> but when I run git status I get the fatal: not a git repository error.

What I want to know is, if I run git init in the local directory that was cloned, will it screw anything up or cause issues with the initial repo on GitHub?

I cd && ls -a into a few directories but I don't see the .git file.

So I first did a search with $ git ls-files | grep .git and got the same fatal no repo error.

Then I did a search with $ find . | grep .git and it listed 3 .gitignore files. Which I assume means the initial creator didn't initialize git.

I want to create a branch and begin working and making commits without messing up the original repo.

I've referenced these following StackOverflow questions but they don't give me the answer I need:

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

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

2

There are 2 best solutions below

2
On BEST ANSWER

Your repository seems to be broken. Make sure that you didn't erased by error the .git folder after cloning. Maybe, just clone again and work from that new clone.

0
On

I think .git file might be hidden.

To fix this go to "Folder Options" then press "show hidden files, folders and drives".

Then do not forget to navigate into the folder where .git resides.

This may fix it, if I got your problem right.

Cheers.