已经维护起来的文件,即使加上了gitignore,也无济于事。 用下面这个命令: git update-index --assume-unchanged logs/*.log 这样每次提交就不会出现logs下面的文件了