问题原因:
自动生成的.git文件和.gitignore文件中没有添加.idea文件,但是这个自动创建的.gitignore文件配置在创建本地库的同时已经添加进了本地库的缓存中
解决办法:
清除本地库忽略文件配置缓存
在gitbash中删除缓存即可
git rm -r --cache .
提交本次保存
git commit -m “update .gitignore”
备注: 清除缓存可能会出现失败
错误如下:
error: the following file has staged content different from both the
file and the HEAD:
.idea/workspace.xml
(use -f to force removal)
`git rm -r -f --cache .idea/workspace.xml (被占用的名称)
然后再清除缓存即可