Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 23, 2026

Users with multiple GitHub accounts (personal/work) often encounter cryptic 404 errors when the extension uses the wrong account for a repository. The "Manage Account Preferences" feature exists but is difficult to discover.

This PR surfaces account preferences when access errors indicate the user may be authenticated with the wrong account.

Changes

src/github/credentials.ts

  • showWrongAccountModal() - displays modal explaining the user may have multiple accounts, with button to open VS Code's account preferences command
  • isAuthenticatedForAccountPreferences() - gating check before showing the modal

src/github/folderRepositoryManager.ts

  • 404 errors in getPullRequestsForCategory() now trigger the wrong account modal instead of generic warning

src/view/treeNodes/categoryNode.ts

  • 403 errors add "Check Account Preferences" action to the error notification
  • 404 errors delegated to folderRepositoryManager (prevents duplicate messages)

Example Flow

When fetching PRs fails with 404:

Unable to access repository "owner/repo" with the current GitHub account (username). 
You may have multiple GitHub accounts configured. Would you like to check your account preferences?

[Manage Account Preferences]

Clicking the button invokes _account.manageAccountPreferences for this extension.

Original prompt

This section details on the original issue you should resolve

<issue_title>Detect if the user has multiple accounts, and if the one configured for the workspace might be the wrong one</issue_title>
<issue_description>I'm using this extension with VSCode Insider and I keep receiving this notification.

Image

What I think might be causing this issue is because I have two git accounts configured in my macos using Git Credential Manager. One for personal use and one for work use. And because of that my remote origin URL will be having username@github.com in my work related repos. is that a reason?

I have this extension working in VSCode for my personal repos for which remote url doesn't contain username.

I'm using VS Code for personal repos and VSCode insider for work repos.

Here is my VSCode Insider Details:

Version: 1.104.0-insider (Universal)
Commit: 966ec1415440da5f1ef53acbd97ba2113add8853
Date: 2025-09-02T05:05:45.743Z
Electron: 37.3.1
ElectronBuildId: 12259562
Chromium: 138.0.7204.235
Node.js: 22.18.0
V8: 13.8.258.31-electron.0
OS: Darwin arm64 24.6.0
```</issue_description>

<agent_instructions>See this comment specifically: https://github.com/microsoft/vscode-pull-request-github/issues/7745#issuecomment-3323104633</agent_instructions>

## Comments on the Issue (you are @copilot in this section)

<comments>
<comment_new><author>@alexr00</author><body>
A few questions/thoughts:
- Are you signed in to VS Code with GitHub with multiple accounts? If so, you can choose which one is used with this extension.

<img width="1313" height="583" alt="Image" src="https://github.com/user-attachments/assets/38ab8b26-f84d-44bf-b51c-123edb8211b1" />

<img width="1893" height="658" alt="Image" src="https://github.com/user-attachments/assets/a9bb762b-0a70-4d37-bf8a-3dc7d4c89e10" />

- What is the output of `git remote -v`? If you have remotes that you want the extension to ignore, you can remove them from `githubPullRequests.remotes`.</body></comment_new>
<comment_new><author>@alexr00</author><body>
@TylerLeonhardt FYI. I've seen a couple times that folks are having a hard time finding this.</body></comment_new>
<comment_new><author>@TylerLeonhardt</author><body>
This functionality is also in a few other places:
* right click on an extension in the the extension list -> Account Preferences
* (new in 1.104) a command in the Command Palette for Managing Account Preferences

... besides adding yet another item to the Account menu, I'm not sure where else to put this tbh</body></comment_new>
<comment_new><author>@alexr00</author><body>
@TylerLeonhardt and I discussed this. If we can detect in the PR extension that you might be using the wrong account, then we should show a modal dialog and then run the "Manage account preferences" command. </body></comment_new>
<comment_new><author>@TylerLeonhardt</author><body>
@Hydhen then you must be hitting something else. Open a new issue.</body></comment_new>
</comments>


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits January 23, 2026 12:28
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
Copilot AI changed the title [WIP] Detect multiple accounts and check workspace configuration Suggest checking account preferences when repo access fails Jan 23, 2026
Copilot AI requested a review from alexr00 January 23, 2026 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Detect if the user has multiple accounts, and if the one configured for the workspace might be the wrong one

2 participants