0

I have a project I want to upload from Visual Studio Code by using the Terminal and the command:

git add .

See down below error message.

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

I don't understand how to solve this.

rioV8
  • 24,506
  • 3
  • 32
  • 49
  • 1
    To add files to git repo, you need to have one. Have you done one for your project? Are you in that directory? If you don't have one, you need either to init one (a new one) or clone one (existing project) – James Z Oct 06 '19 at 15:30

2 Answers2

0

This error message indicates that either you haven't initiated a git repository or you are trying to stage the files from the wrong path. In your terminal go to the directory and try staging the files again. It should work as intended.

0

The error message indicates you do not have a git repository. You need to make one, and then you can commit changes to it, and push it to a remote:

<in the root directory of the project>
git init
git add <files to add>
git commit
git remote add origin <url for remote>
git push --set-upstream origin master

You can get the url for the remote from your git host provider. You make a project/repository there, and it will give you the git URL.

David Sugar
  • 1,042
  • 6
  • 8