Home > Software design >  Use Git in Visual Studio 2022
Use Git in Visual Studio 2022

Time:11-23

I cloned a remote repository from Visual Studio Code some weeks ago. Today, if I open the folder containing the local repository with Visual Studio 2022, it does not "load" the .git information, does not display traditional git commands. I have no problem on this repo with Git Bash for example, so it seems to me it's a Visual Studio issue.

I struggled with this for hours, if you have some insight on how to solve this issue, it would make my day.

CodePudding user response:

Most of the time it is caused by unsafe repo. Older versions of VS2022 do not properly show the errors related to the repo not being safe. At version 17.4.1 it even shows a window to help you add the repo to the Git's trusted ones.

But if you can not update VS, you can add the repo folder to the trusted list with this command:

git config --global --add safe.directory [yourDirectoryPath]
  • Related