在idea中的与.git文件同级目录下,添加.gitignore文件,此时,并不能立即生效,需要执行如下语句: 注意:后面是 有一个点的。 git rm -r --cached . git add . git commit -m "update gitignore"