问题
笔记本重装系统后,用idea再次打开以前的项目,在切换分支或者添加修改至工作区时,idea会弹窗提示如下
detected dubious ownership in repository at 'E:/workspace/learning/test-demo' 'E:/workspace/learning/test-demo' is owned by: 'S-1-5-21-3470852206-1490677793-3352217626-1001' but the current user is: 'S-1-5-21-123804421-2857097640-817745698-1001' To add an exception for this directory, call: git config --global --add safe.directory E:/workspace/learning/test-demo
解决方案
仔细看idea弹窗提示的内容,在描述末尾已经告诉了我们解决方案,就是将当前项目目录添加到git的安全目录列表中。
在项目根路径下,打开git bash终端,然后执行下面命令即可。
git config --global --add safe.directory E:/workspace/learning/test-demo
执行成功后通过以下命令查看git全局配置列表,可以看到你已经添加的安全目录
git config --global --list