Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

git

When I tried to push an existing repository on github.com, and it when I entered the command the website prompted me to put into the terminal, I got this error message fatal:

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

If anyone could help me with this, then that would be great, thanks.

like image 722
user3072482 Avatar asked Dec 06 '13 00:12

user3072482


People also ask

How do I fix fatal not a Git repository or any of the parent directories?

For the second situation, you need to initialize the Git repository in your project folder. To do so, you need to navigate to the correct folder and then run the command git init , which will create a new empty Git repository or reinitialize an existing one.

Can I copy .Git folder?

Thanks. Yes you can, but there's no need to copy the full working tree. You can copy just the . git folder without the working tree (i.e. as a "bare" repo) and then checkout the latest working tree on the other machine.


1 Answers

The command has to be entered in the directory of the repository. The error is complaining that your current directory isn't a git repo

  1. Are you in the right directory? Does typing ls show the right files?
  2. Have you initialized the repository yet? Typed git init? (git-init documentation)

Either of those would cause your error.

like image 167
Daniel Gratzer Avatar answered Sep 21 '22 00:09

Daniel Gratzer