git add . -> still "nothing to commit" with new files
Your commands look correct (I've done them many times that way).
First try
git add --all
and then try git status
. I don't think that will solve it, but worth trying next.
Next try looking at your .gitignore file, if you have one (in the top level where you did git init
).
cat .gitignore
Remove any listings there that are causing your files to be ignored. For example is there an entry with just *
?
Next try:
git add --force
and then try git status
.
If none of those work, I notice that your output from git init
says "reinitialized" rather than "initialized", so something may have gotten messed up. If you've just initialized it and don't mind losing history, start over by removing the .git dir:
rm -rf .git
And then reexecute your same commands above. If that doesn't work, some more information about your setup will be required. For example, you might have a global .gitignore file: ~/.gitignore_global
that needs to edited (or removed if you don't want it).
In case somebody else bumps into this, another reason that git does not add a directory is that maybe there is a .git
directory within that directory.
In this case, git expects you to treat that as submodule. Otherwise, simply remove that .git
(in the directory, not the root) and retry.
Handy command:
find . -name '.git' -type d
Since I've experienced a similar issue multiple times I would just like to add that you should double check that you're trying to add from and are currently in the root folder of your project.