'Visual Studio is not recognizing git repo
Upon opening my ASP.NET Core project with an existing git repo in Visual Studio 2022, the git repo is not being loaded. However, opening a freshly cloned repo of this project from GitHub works fine. And opening other projects with git repos work fine. What could be the issue?
Solution 1:[1]
Had the same issue after upgrading to latest version of VS2019 and had a look at the output from "Source Control - Git", there were messages of a fatal error because of no access and suggesting running the following:
git config --global --add safe.directory path/to/repo
After running it and restarting VS2019 it works OK.
Solution 2:[2]
Had the same problem running VS2022 under Win10. Problem was that the ownership of the file system directory containing the solution and git data had changed to Administrator. After changing the ownership back to my normal windows user account everything worked fine again.
Solution 3:[3]
I ran into the same problem.
Visual Studio Code and Git bash correctly recognized the repo but not Visual Studio 2022.
I installed the latest version of Git in the system, and the visual studio recognized the git repo correctly.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | patriml |
Solution 2 | maze |
Solution 3 |