git add . did nothing.You ran git add ., then git status does not show the file you expected. Git is almost never broken. One of five things is happening.
pwd prints your folder. git add . only adds from the folder you are in, and below it.
git check-ignore -v yourfile prints the .gitignore rule that hides it. No output means it is not ignored.
git status lists staged, changed and untracked files. If the file is in none of those lists, read on.
git add . skips it silently. Naming the file directly prints The following paths are ignored by one of your .gitignore filesgit add -f file.cd to the repository root, or run git add -A to stage the whole repository from anywhere inside it.warning: adding embedded git repository: inner and stages the folder as a single entry, not its files..git folder to make the files normal, or use git submodule add on purpose..gitkeep.fatal: pathspec 'nothere' did not match any filesls. Names are case sensitive on most systems.you@laptop my-project % cat .gitignore *.log you@laptop my-project % git add b.log The following paths are ignored by one of your .gitignore files: b.log hint: Use -f if you really want to add them. you@laptop my-project % git add . you@laptop my-project % git status -s A .gitignore A a.txt
b.log never shows up. git add . did not fail. It followed your rule.
The other way round also confuses people. If Git already tracks a file, adding it to .gitignore does nothing. The file keeps showing as modified. Stop tracking it with git rm --cached file. That removes it from Git but keeps it on your disk. Then the rule works.
fatal: pathspec 'nothere' did not match any filesNo file with that nameCheck spelling and your current folder with pwd and ls.fatal: not a git repository (or any of the parent directories): .gitYou are not inside a repositorySee the fix for this error.Most often the file matches a .gitignore rule, you are in a subfolder, or the folder is a separate Git repository. Run git check-ignore -v file and pwd to find out which.
Run git add -f file to force it once, or remove the matching rule from .gitignore. Use git check-ignore -v file to see which rule matches.
No. Git tracks files, not folders. Put a file in the folder, commonly an empty file named .gitkeep.
Both stage new and changed files. Run from a subfolder, git add . covers that folder only, while git add -A covers the whole repository.