你不想'-u',因为它只会添加你已经跟踪的文件。在git init
之后,你还没有追踪任何东西。从文档:
-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.
使用-A
(或--all
)来代替。
对于您的特定问题,当您编写'* .pdf'时,shell会将其扩展为4500个文件。大量文件可能会溢出shell命令行输入缓冲区;这导致错误。你可以做几件事情:
git add -A # adds everything at once
或
for file in *.pdf; do git add -A $file; done # add files one by one
这两项建议将避免在命令行中的问题;第一个是首选。
我其实犯了一个愚蠢的错误。我编写了git-add命令,而不用单引号括住通配符。就像@GoZoner说的,我误解了选项'-u'的含义。 – luisfsns 2013-03-24 03:06:44