This is what I found and solved my problem
The origin for this "error" is a safety check that was added in Git to address CVE 2022-24765.
Therefore, one needs to put working trees that are on a path not owned by the current user on a safe.directory list.
There seems, however, be an inconsistency between vanilla Git and libgit2 regarding the handling of trailing slashes. For libgit2 to recognize a path correctly as safe, it must not end with a slash.
As a last resort, one can also add the
* exception which completely disables this security check - only do this if you trust all users on your machine
Go to your gitconfig file
:C:\Program Files\git\etc\gitconfig file (if git is installed)
or C:\ProgramData\Git\config (if git is not installed)
add the following:
directory = *