git add doesn't work

Question:

Trying to add a project to git, created a .gitignore
performed the following actions:
git init
git status
git add.
and here is git add. it didn’t work for me
writes
error: 'site_tests /' does not have a commit checked out
fatal: adding files failed

site_tests is just a folder where project autotests are stored
I've already tried everything I could and still can't
moreover, I added a regular .txt file and downloaded only it, and everything worked out, but as soon as I try to download everything, nothing comes out

I will be very grateful for help with my problem

Answer:

I had a similar situation.

I have a folder that contains a bunch of files. And I want to index this folder. But the error flew out: error: 'JS /' does not have a commit checked out fatal: adding files failed

What I've done:

  1. In the JS / folder, I had a hidden .git / folder (which is responsible for the structure of the Git repository). It was superfluous and I deleted it. Note that I had a .git folder at the project level (in my_project folder) and a .git folder in the JS folder was redundant.
  2. Then, according to this book: Pro Git: Git Basics – Writing Changes to the Repository . Said: "The git add command takes a path to a file or directory as a parameter, if it is a directory, the command recursively adds all files from the specified directory to the index.".

That is, you need to specify the path for the directories: For me, the command looked like this: git add C: \ Users \ User \ my_project \ JS, and everything was indexed correctly.

Scroll to Top