The error message fatal: detected dubious ownership in repository at.. happens when Git detects that the current user is not owner of the Git repo directory.
Prerequisites
- Git
Solution(s)
As for the solutions, try the following:
- Make sure the current user running is owner of the
.gitdirectory e.g.chown -R <user> <directory>. - Run
sudo -u user git <the_rest_of_the_command>. - Run
git config --system --add safe.directory '<directory>'. If that doesn’t work try with--globalinstead of--system. - Update locals
.gitconfigusually found under $HOME directory. For example:[safe] directory = <directory_path>
Conclusion
In case you face any issues, feel free to leave a comment below and if you find this tutorial useful, follow our official channel on Telegram.