Visual Studio and Git in strange situation

Nicholas Piazza 536 Reputation points
2022-05-10T15:51:35.697+00:00

I have a GitHub repository that has gotten into a weird state in Visual Studio 2022. When I open a certain solution in VS 2022, the Status Line has “Add to Source Control”. However, when I try to add the solution to Git, the “Create a Git repository” dialog box says the repository already exists. But if I right-click on a solution, project, or file in the VS Solution Explorer, there is no Git menu item, so there is no way for me to update the repository. I have deleted the online repository and have deleted all files or folders in my solution folder with Git in their name. But, I still have part of VS2022 that thinks I have a local repository, and another part of it that doesn’t show it anywhere. How do I resolve this dilemma?

The Source Control - Git output window in VS2022 shows three lines saying: "One or more error occurred.", but doesn't tell me what the error is or how to resolve it.

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,851 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Nicholas Piazza 536 Reputation points
    2022-05-12T21:11:25.363+00:00

    Was finally able to solve this problem after installing the latest update to VS2022 (17.2.0). Instead of just saying "One or more errors occurred", it gave an action to perform: git config --global --add safe.directory path_to_repository. That was able to solve the problem.

    0 comments No comments

  2. Nicholas Piazza 536 Reputation points
    2022-05-12T21:12:59.25+00:00

    Was finally able to solve this problem after installing the latest update to VS2022 (17.2.0). Instead of just saying "One or more errors occurred", it gave an action to perform: git config --global --add safe.directory path_to_repository. That was able to solve the problem.

    0 comments No comments