Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
+1 vote
2 views
in DevOps and Agile by (29.3k points)
edited by

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 give the above fatal: Not a git repository (or any of the parent directories) error.

What am I doing wrong?

1 Answer

+1 vote
by (50.2k points)

For this question, you need to enter the directory and then if you run 

git status 

Then the status shows that you are on the master.

example:- 

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

Cloning into 'directory'...

remote: Counting objects: 3005, done.

remote: Compressing objects: 100% (2141/2141), done.

remote: Total 3005 (delta 1052), reused 2714 (delta 827)

Receiving objects: 100% (3005/3005), 23.80 MiB | 2.22 MiB/s, done.

Resolving deltas: 100% (1052/1052), done.

$ git status

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

$ cd directory

$ git status

# On branch master

nothing to commit (working directory clean)

You can also read an article on most used Git Commands while working with Git.

fatal: not a git repository (or any of the parent directories): .git
Intellipaat-community
by (19.4k points)
I was able to resolve this issue by initializing the git using git init. It worked.

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...