git bash报错fatal: detected dubious ownership in repository at的解决方法

发布时间 2023-04-05 18:51:50作者: Clotho_Lee

情况

在git bash中输入"git add ."命令时报错"fatal: detected dubious ownership in repository at"

 

文件夹的所有者和现在的用户不一致

例如:文件夹的所有者是Administrator,而当前用户是myAccount

 

方法1

右键文件夹 -> 属性 -> 所有者 -> 更改 -> 勾选应用到所有子目录和文件 -> 应用

 

方法2(简便)

在git bash中输入

git config --global --add safe.directory "*"