19

Ran Visual Studio Installer for the following:

  1. Added 'Desktop Development with C++'
  2. Updated VS to the latest version 17.1.4

Now when I load any project, it is no longer under source control. In the Git output window, I get a very helpful "One or more errors occurred".

enter image description here

Using the Bitbucket as source control provider.

I've tried going to the Git menu and the only enabled options are to create a repo or connect to a local repo. I've tried connecting to local with no results.

Is there a way I can find out what the errors are?

JamesF
  • 434
  • 5
  • 17
  • 3
    This issue is under investigation at MS. You can vote for and follow here: https://developercommunity.visualstudio.com/t/Git-Error-after-1714-update/10012565 – JamesF Apr 18 '22 at 14:44

9 Answers9

7

I cannot connect to git repo and get the "One or more errors occurred" message in the Git output after updating VS to 17.1.4 - on only some of my repos, not all. I do not use the Atlassian Bitbucket source control service.

When running VS 2022 'as administrator' connection to the git repo is possible without errors.

Kathleen
  • 133
  • 1
  • 7
  • 1
    Confirmed - this solution works for me as well – JamesF Apr 17 '22 at 13:39
  • Not working for me. One note: my solution is on a different drive (D) then my git install location (C) – Enrico Apr 21 '22 at 12:01
  • Worked for me as well. This is how you always open VS as admin: https://stackoverflow.com/questions/9654833/how-do-i-run-visual-studio-as-an-administrator-by-default – Fernando Lopes Apr 25 '22 at 12:25
7

I had the same problem after updating to 17.1.5. I checked the ownership of the folder of my local repository and my project (Working Tree). Setting the ownership to myself fixed the problem.

TO DO THIS:

  1. Right-click on the folder containing the working tree and .git folder.
  2. Click Properties
  3. Go to tab Security.
  4. Click the Advanced button.
  5. Click Change for the owner.
  6. Select your user name.
  7. Check Replace owner on subcontainers and objects.
  8. Click Apply and Ok.

VS can then open the local repository.

Arman
  • 796
  • 6
  • 12
  • May not be the correct solution for large enterprise networks but when can you see that the previous developer is the owner of the directory, this is the fast and simple solution. – EllieK Apr 25 '22 at 15:05
3

Problem is solved. 1- first install GitHub Desktop 2- add local your repository to GitHubDesktop 3- All Done. now open project in visual studio

Omital
  • 212
  • 2
  • 12
  • 2
    I tried "Run as administrator", "git config --global --add safe.directory /path/to/repo " and other asnwers but only install Github desktop and add local respository to it worked. – Mehmet Apr 25 '22 at 07:53
2

Had the same issue. Seems linked to a security update of GIT (see article).

The problem had several phases on my side.

  • Did not update GIT but VS to 17.1.4 and had the problem in the IDE but CLI worked.
  • Found this info above and updated GIT. Problem did persist in VS and CLI explicitly asked me to type a command. git config --global --add safe.directory /path/to/repo which worked to unlock the feature on both CLI and VS.

So git update or git update-git-for-windows in CLI. That may not be necessary but I did reboot.

UchiTesting
  • 111
  • 8
2

I ran the following command and my issue is now resolved.
Open cmd then run the following:

git config --global --add safe.directory /path/to/repo
Reza Rahemtola
  • 1,182
  • 7
  • 16
  • 30
1

Yep Git from inside Visual Studio is broken here since updating VS. Updated Sourcetree Git, System Git, Deleted then Re-Created repo etc. same continuous error: "One or more errors occurred."

I am going back to sticking with doing SCC in Sourcetree from outside of VS and wait for a fix - or not - as the case may be.

FYI: its only a local repo without remote: maybe something to do with getting the credentials stored by Sourcetree in the Windows Credential Store i.e. credential helper or something..

(There are much much better Software Dev things to do than wasting time trying to fix someone else's dodgy SCC interop tool: coughs (Microsoft) and coughs again.)

mattjs
  • 144
  • 1
  • 5
1

I faced the same issues when VS2022 was updated to version 17.1.14. The solution from @Ken Bonnin Jr can solve this problem. For the details, I have to run the following code in each location included .git file.

git config --global --add safe.directory %(prefix)/Path

Path is the address at .git file with symbol'/'.

Bingbo
  • 11
  • 2
  • Make sure you don't include a trailing slash otherwise won't work. For example, `git config --global --add safe.directory C:/Users/Public/repos` works but `git config --global --add safe.directory C:/Users/Public/repos/` does not. The latter will get added to the config but you might still get errors in Visual Studio. – Dan Stevens Apr 21 '22 at 21:06
1

it weird i just update git and ran as administrator problem solved

  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Cristik Apr 18 '22 at 16:30
0

I tried both of the suggestions by @UchiTesting and got some success with our github hosted repositories. My original code folder worked fine until 17.1.4.

This appeared to reconnect VS and github again:

  • Launch VS 17.1.4 as Administrator
  • Menu > Git > Clone Repository to a new folder
  • Note the repository information is correct
  • Close VS and relaunch as Administrator
  • Open the solution file directly

The repo and branch info appear to be retained in VS 17.1.4 on the clone, but only as Administrator. Opening this new clone as non-Administrator does not appear to bring the same results.

Regarding the original folder that stopped working after the 17.1.4 upgrade (and I always run as Administrator), I followed the steps with both git update-git-for-window and git config --global --add safe.directory /path/to/repo.

Opening the original folder as Administrator now remembers git info.