你不想'-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