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?
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.
'
instead of "
to wrap the directory. I got a git error: error: wrong number of arguments, should be 2
I determined that this error was because my directory has a space in it. I replaced the single quote with a double quote, and it worked after that. –
Inevitable If you run VS 2022 as an Administrator, it should load everything as it should.
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.
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.
© 2022 - 2024 — McMap. All rights reserved.
.git
folder in the freshly cloned project with the.git
folder in the existing project works fine in Visual Studio. – Substratosphere.sln
solution file. I'll use a diffing tool to see the differences. – Substratosphere