Reputation: 16991
Visual Studio 2022 has started showing one of my git repos as "Untrusted". What does this mean? How can I fix it?
Upvotes: 25
Views: 11352
Reputation: 114847
This is a new security feature in Git to prevent people from sticking things into a shared git repo to infect your PC. It may have been a bit overboard, but now we'll have to deal with it in every tool on our PCs that use Git:
This change in Git came about due a security issue which allows parent repositories directories to override permissions of child repositories in some situations which would potentially allow execution of commands with unintended consequences. You can read more detail about the specific vulnerability here:
Git Security Issue: CVE-2022-24765
There are a number of solutions for this problem.
git config --global --add safe.directory <Git folder>
Manually adding an entry to the git config:
[safe]
directory = d:/projects/path
Developer Tools can set Safe Repo Status, click view details in the yellow information bar:
Change Folder Ownership. In the File System properties on your machine, change the owner of the directory to be your user.
Upvotes: 30