当前位置:   article > 正文

git报错fatal: detected dubious ownership in repository at

fatal: detected dubious ownership in repository at

git报错

在git上执行
git branch
fatal: detected dubious ownership in repository at ‘/home/你的用户名/cam/code’
To add an exception for this directory, call:

git config --global --add safe.directory /home/你的用户名/cam/code
  • 1

这个一般是权限不足导致的,有两种解决方式:
1.sudo su进入到root权限

sudo su
  • 1

然后输入你的密码
2.这个错误提示表明在您的Git仓库中发现了一个可疑的文件夹,该文件夹的所有权可能已被恶意篡改。为了避免潜在的安全问题,Git阻止执行某些操作。

根据错误提示,您可以通过调用以下命令来为该目录添加一个例外:

git config --global --add safe.directory /home/你的用户名/cam/code
该命令会将/home/hpyd/camera/ipccode添加到全局安全目录列表中,以便Git能够正常操作该目录。

请注意,如果您不确定该目录是否受到威胁,您应该先检查该目录的所有权和权限设置,确保它们是正确的。如果您相信该目录是安全的,您可以通过使用上述命令来添加一个例外,以便Git正常工作。

git config --global --add safe.directory /home/你的用户名/cam/code
  • 1

建议使用第一种

本文内容由网友自发贡献,转载请注明出处:https://www.wpsshop.cn/w/不正经/article/detail/397101
推荐阅读
  

闽ICP备14008679号