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?
Visual Studio is not recognizing git repo
14.7k views Asked by Raj Narayanan At
5
There are 5 answers
2
On
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.
2
On
In my case the project was cloned in console with Administrator rights. All worked good in console but Visual Studio was not read the .git folder.
Actually folders has enough rights for Authenticated Users group that was assigned for all child objects but Visual Studio still not see .git folder.
Only after change owner of project folder and all child objects to current account Visual Studio seen .git
Steps:
- Open Properties of project folder.
- On tab Security select button Advanced.
- Select tab Owner and button Change.
- In List select your account plus check "Replace owner on subcontainers and objects".
- Click Apply
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.