Git - fatal: detected dubious ownership in repository
I got some git errors while building my keyboard firmware

Adding git config --global --add safe.directory /some/path/ works, but it will took some time to add it one by one.
However, you can add wildcard safe directories using "*" 1, allowing every directories to be fetched.
git config --global --add safe.directory "*"