1、File->Settings
2、在左侧菜单找到Plugins,点击Browse repositories
3、搜索.ignore,点击Install 安装后重启
4、在model上右键->New ->.ignore file ->.gitignore file(Git)
5、添加文件内容
target
.settings
.classpath
.gitignore
.project
.idea
*.iml
out
gen
6、右键项目hide ignored files
7 view->tools Windows->Terminal
8 定位到项目目录下执行以下命令
git rm -r –cached .
git add .
git commit -m "update .gitignore"
完成