fatal: Not a git repository

11

I created a repository in GitHub and then I was playing files by Git using

cd C:\Users\Nikolai\Desktop\exercicios-c
git remote add origin https://github.com/NikolaiCinotti/exercicios-c.git 
git push -u origin master

And I got the error:

  

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

I have already created a repository that in this case is this: link

    
asked by anonymous 17.08.2016 / 21:35

1 answer

13

Your repository is empty. You must first initialize it on your local machine, and only then can push . The procedures are as follows:

Creating a local repository:

> cd C:\Users\Nikolai\Desktop\exercicios-c
> git init

Then add any file, it can be source code, text, image. Anyone. It is normal to have a "contributors.txt" file in the repository, with the names of the members in development.

> echo "Nikolai Cinotti" > contributors.txt

Add the file to the repository and commit:

> git add contributors.txt
> git commit -m "Primeiro commit!"

Send to remote server:

> git remote add origin https://github.com/NikolaiCinotti/exercicios-c.git
> git push -u origin master

By using Windows, the syntax of the commands may have some change that I do not know because the Windows terminal is more limited than Bash.

Correction: had entered the command git push wrong. Note that the second parameter is -u , not -i as you typed.

    
17.08.2016 / 21:44