Cannot Add GitHub Account from Visual Studio 2022 Account Settings

Viewed 1235

I have just upgraded from Visual Studio 2019 to Visual Studio 2022 and I have encountered a strange problem. When going to File -> Account Settings..., under "All Accounts" I used to have both my Microsoft account (which is also my Personalization Account) and my GitHub account. In VS 2019, there was no issue adding the GitHub account, but I have not been successful in VS 2022. When I select +Add▾ then GitHub/GitHub Account, the Connect to GitHub dialog pops up asing me to Sign In to either GitHub or GitHub Enterprise. Since my account is GitHub and not GitHub Enterprise, the only sign in option listed is "Sign in with your browser".

When I select Sign in with your browser, I get redirected to https://visualstudio.microsoft.com/vs/github-signed-in/ and I get the message "Success! Your authorization was successful. You can now return to Visual Studio."

The expected result at that point would be to see my GitHub account listed under All Accounts, but I do not. The other expected result would be to see Visual Studio listed in my GitHub account under Authorized OAuth Apps, and I do see it there, so it does look like the authorization was successful. As well, I can access repositories without issue, so it looks like the problem is inside Visual Studio 2022.

Has anyone else experienced this issue? Is this a known issue that Microsoft is working on?

EDIT: I found this on the Microsoft Docs, which lays out the steps I was following. Under Adding public GitHub Accounts, I get to Step 3 ok, but then at Step 4, I do not get the expected result.

I've also found out this is preventing me from creating a new repository from VS, or opening a repository directly from VS. I can still work with local repositories cloned via GitHub Desktop, but that's about it.

Very annoying.

3 Answers

I had a suspicion that this was related to some type of settings cache or potentially some type of previous Git setting. After wiping out all of my Visual Studio settings and re-setting to factory defaults (which is another annoyance) using the following commands, it started working for me:

devenv.exe /ResetSettings
devenv.exe /ResetUserData

When I clicked Manage Connections, the GitHub option wasn't available in the usual spot. Only the Microsoft Sign on. I found another spot to connect to GitHub;

  • Open the Team Explorer (View -> Team Explorer).
  • Click the Connect | Offline drop down from the top of the explorer.
    • Projects -> New Repository

enter image description here

  • Under Create a new GitHub repository select Add an account under the account field to open up the sign on page for GitHub.
Related