You don't want '-u' as it will only add files that you are already tracking. After a git init
you are not tracking anything yet. From the documentation:
-u, --update: Only match against already tracked files in the index rather than the working tree. That means that it will never stage new files, but that it will stage modified new contents of tracked files and that it will remove files from the index if the corresponding files in the working tree have been removed.
Use -A
(or --all
) instead.
For your specific problem, when you write '*.pdf' the shell expands that into 4500 files. That large number of files probably overflows the shell command line input buffer; which leads to the error. You could do a few things:
git add -A # adds everything at once
or
for file in *.pdf; do git add -A $file; done # add files one by one
Both of these suggestions will avoid the command line issue; the first is preferred.