Search code examples
visual-studiogithubvisual-studio-2022

Cannot Add GitHub Account from Visual Studio 2022 Account Settings


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.


Solution

  • I had same issue.

    What helped was to update to latest VS 2022 and run Credential Manager and remove some of the old passwords (I deleted some pass from windows and web credentials, dont know which helped).

    See: https://developercommunity.visualstudio.com/t/Problem-adding-Github-Account/10416187