git rm -r --cached . -- 注意最后一个点,这个是清除git的缓存,不会删除源文件 git add . -- 注意最后一个点,重新加入git git commit -m "update gitignore" -- 提交更新.ignore文件