This is what I found and solved my problem
c# - LibGit2Sharp Exception: repository path not owned by current user - Stack Overflow
“
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:
[safe]
directory = *
very valid option also for when using parallels on a mac, then you might also face this issue due to the C, Y and emulation drive!