【ubuntu】fatal: detected dubious ownership in repository at ...

ubuntu使用git的时候遇到了以下错误:

fatal: detected dubious ownership in repository at '/home/xxx'
To add an exception for this directory, call:
git config --global --add safe.directory /home/xxx

谷歌在一篇博客中得到解决方法:

  • 方法1:修改文件的所有者
chown -R root /home/xxx

PS: 可以用who, users查看当前登录用户,用grep bash /etc/passwd查看所有用户。

  • 方法2:手动禁用安全目录
git config --global --add safe.directory '*'

本人用方法1已解决问题,方法2具体细节请参考上文提到的博客。
转自:https://blog.csdn.net/qq_40690815/article/details/126604030

posted @ 2023-02-17 10:38  MasonLee  阅读(355)  评论(0编辑  收藏  举报