5

I cloned one of my projects in windows desktop and after editing when I input git add . command then I get following error:

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

How to solve this?

1
  • How you cloned the project? Are you sure that you have copied .git directory (which usually is hidden) too? Commented Jan 9, 2017 at 10:17

1 Answer 1

1

When you type git clone it will create a subdirectory in the current directory. e.g. If your current working directory is /code, the command line output could look similar to this:

$ pwd
/home/you/code [or something similar]
$ ls -F
foo  bar
$ git clone http://somewhere.baz/somerepo.git
[happy git output]
$ ls -F
foo  bar  somerepo/

as you see you repo was cloned to the somerepo subdirectory, so the full path would be something like ~/code/repo_name. However, your current working directory remains the same, ~/code.

Next, you should step into that directory:

$ cd somerepo
$ ls
[content of your repo]

After you've changed the current working directory, you should be able to see its content (output of ls command), and be able to see git repository state with the git status command.

Sign up to request clarification or add additional context in comments.

1 Comment

I think cloning the repository is not always helpful. Especially if local changes have been made.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.