Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2022 shows git repo as "Untrusted"

Visual Studio 2022 has started showing one of my git repos as "Untrusted". What does this mean? How can I fix it?

enter image description here

like image 849
Bradley Uffner Avatar asked Sep 08 '25 11:09

Bradley Uffner


1 Answers

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:

Why oh Why?

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

Quick Fixes

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:

     enter image description here

  • Change Folder Ownership. In the File System properties on your machine, change the owner of the directory to be your user.

For details see here.

like image 160
jessehouwing Avatar answered Sep 10 '25 05:09

jessehouwing