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

The first time I used git, I encountered this error prompt. It turned out to be like this:

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

This tells you that the directory you’re in is not a git repository. Before you can add remote servers, commit things and so you must have a git repository created.

In a git repository there’s a directory (which can be hidden) named.git. It contains metadata on the repository and all the data regarding the checked files.

To create it typegit initin the directory you wish to have a git repository. Then you could add remote servers and perform operations on it.

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

After this problem, we found that there is no such directory as. Git in this system, so we used git — help command in the terminal to display some of its main command parameters. We found that one parameter is init: help

2.init Create an empty git repository or reinitialize an existing one

After git init is executed and then recompiled, this problem is solved. One thing to note here is that unlike SVN, SVN does not need to use its own commands to create its own repository, while git needs to use its own commands to create it manually. The specific location of GIT depends on which directory you execute the command in

Similar Posts: