Unable to connect Github enterprise using visual studio 2019

Octokit.AuthorizationException: Must authenticate to access this API.
at Octokit.Connection.HandleErrors(IResponse response)
at Octokit.Connection.d__58.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Octokit.Connection.d__571.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Octokit.ApiConnection.<Put>d__261.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at GitHub.Api.LoginManager.d__18.MoveNext() in C:\projects\visualstudio\src\GitHub.Api\LoginManager.cs:line 220
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at GitHub.Api.LoginManager.d__13.MoveNext() in C:\projects\visualstudio\src\GitHub.Api\LoginManager.cs:line 102
— End of stack trace from previous location where exception was thrown —
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at GitHub.Api.LoginManager.d__13.MoveNext() in C:\projects\visualstudio\src\GitHub.Api\LoginManager.cs:line 125
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at GitHub.VisualStudio.ConnectionManager.d__13.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at GitHub.ViewModels.Dialog.LoginTabViewModel.d__55.MoveNext() in C:\projects\visualstudio\src\GitHub.App\ViewModels\Dialog\LoginTabViewModel.cs:line 159
{“message”:“Must authenticate to access this API.”,“documentation_url”:“https://developer.github.com/enterprise/2.19/v3”}

Hi @mohan023! :wave:

Did you manage to get to the bottom of this authentication problem?

Are you using the GitHub extension for Visual Studio? What steps did you take to log in to your GitHub account through Visual Studio?

It’s possible your problems are being caused by old or incorrect credentials being cached in Windows.

To remove any cached credentials from the Windows Credential Manager, you’ll want to:

  • Open the Start Menu
  • Search for Credential Manager, and open it
  • Find a GitHub username and password under Generic credentials, and remove them

You might also find this documentation helpful:

https://docs.github.com/en/github/using-git/caching-your-github-credentials-in-git

(Click for Windows version)

I hope that helps!