一、安装插件
1、File->Settings
2、在左侧菜单找到Plugins,点击Browse repositories
3、搜索.ignore,点击Install 安装后重启
二、添加文件
4、在model上右键->New ->.ignore file ->.gitignore file(Git)
三、文件内容
### Go template
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
# Test binary, built with `go test -c`
*.test
# Output of the go coverage tool, specifically when used with LiteIDE
*.out
# Dependency directories (remove the comment below to include it)
# vendor/
.idea
*.xml
四、不生效原因解决
在对应的项目文件夹目录下
git rm -r --cached .
然后重新add提交
参考文章: