When you have multiple GitHub accounts, Visual Studio Code can sometimes sign in to the wrong GitHub Copilot subscription. You might see an error that Copilot is not active, or it generates code based on the wrong account’s permissions. This happens because VS Code caches the authentication token from whichever GitHub account you used last. This article shows you how to clear that cached session and force VS Code to sign in with the exact GitHub account that has the Copilot license you want to use.
Key Takeaways: Switching GitHub Copilot Accounts in VS Code
- VS Code Command Palette > GitHub: Sign Out: Removes the current GitHub authentication token from VS Code, forcing a fresh login on next use.
- VS Code Settings > GitHub > Authentication Provider > GitHub: Lists all cached GitHub accounts; you can remove the wrong one directly from this menu.
- Keychain Access (macOS) / Credential Manager (Windows): Stored OAuth tokens for VS Code; deleting the entry for “vscode” or “github.com” ensures no stale credentials remain.
Why VS Code Connects to the Wrong GitHub Account
VS Code authenticates with GitHub through a built-in OAuth flow. When you sign in, VS Code stores the resulting access token in your operating system’s credential manager. This token includes the user identity and the scopes granted, including Copilot access. If you have two GitHub accounts — for example, a personal account and a work account — VS Code does not automatically distinguish between them. It simply uses the last valid token it finds. If that token belongs to an account without an active Copilot subscription, Copilot features will not work. The root cause is that VS Code does not natively support multiple simultaneous GitHub Copilot sessions. You must manually switch the active account by clearing the cached token and reauthenticating.
Steps to Force VS Code to Use a Specific GitHub Copilot Account
Follow these steps to remove the current GitHub session and sign in with the account that has the Copilot license you want.
- Open the Command Palette
Press Ctrl+Shift+P on Windows or Cmd+Shift+P on macOS. This opens the VS Code command palette where you can run any command. - Run the GitHub Sign Out Command
Type GitHub: Sign Out and select it from the list. VS Code will immediately sign out of the current GitHub account. You will see a notification confirming the sign-out action. - Clear the Cached Credentials from the OS Credential Manager
On Windows, open Control Panel > Credential Manager > Windows Credentials. Look for entries under “Generic Credentials” that contain “vscode” or “github.com”. Click the arrow to expand each entry, then click Remove. On macOS, open the Keychain Access app, search for “vscode” or “github”, find the item named “vscode-auth” or similar, and delete it. On Linux, the tokens are stored in the libsecret keyring. Use the command secret-tool search service vscode to list entries, then delete them with the corresponding delete command. - Sign In to GitHub Again
Open the Command Palette again. Type GitHub: Sign In and press Enter. VS Code will open a browser window asking you to authorize VS Code. Make sure you are already signed into the correct GitHub account in that browser. If you are not, sign out of GitHub in the browser first, then sign in with the account that has the Copilot subscription. Complete the authorization flow. - Verify the Copilot Status
Open the Command Palette, type Copilot: Sign In, and select it. If Copilot is already active, you will see a status indicator in the bottom-right corner of the VS Code window. Click the Copilot icon to confirm it shows the correct account name. If Copilot is not active, the command will prompt you to sign in again.
If Copilot Still Shows the Wrong Account After Signing Out
Sometimes the standard sign-out command does not remove all cached data. Try these additional steps.
VS Code extension cache still holds the old token
The GitHub Authentication extension inside VS Code may retain a cached token even after you sign out. Open the VS Code settings by pressing Ctrl+, (Windows) or Cmd+, (macOS). Search for github authentication. Look for the setting GitHub > Authentication Provider > GitHub. Click on Edit in settings.json. Add or modify the line “github.authProvider”: “github”. Then manually delete the github-auth folder located in %APPDATA%\Code\User\globalStorage on Windows or ~/.config/Code/User/globalStorage on macOS/Linux. Restart VS Code completely.
Copilot extension has its own cached session
The Copilot extension stores its own authentication state. Open the Extensions view by pressing Ctrl+Shift+X (Windows) or Cmd+Shift+X (macOS). Find the GitHub Copilot extension. Click the gear icon and select Extension Settings. Scroll to the section GitHub Copilot: Advanced. Click Clear Auth Session. This removes the Copilot-specific token without affecting the main GitHub sign-in. After clearing, restart VS Code and sign in to Copilot again from the Command Palette.
Browser session redirects to the wrong account
When VS Code opens the browser for authorization, if you are already signed into multiple GitHub accounts in the same browser, the OAuth flow may pick the wrong one. Open your browser and sign out of all GitHub accounts. Then sign in only to the account that has the Copilot license. After that, retry the VS Code sign-in process. Use a private or incognito browser window to avoid any cookie conflicts.
VS Code Single-Account vs Multi-Account Copilot Management
| Item | Single GitHub Account | Multiple GitHub Accounts |
|---|---|---|
| Number of active Copilot sessions | One — no switching needed | One at a time — must manually switch |
| Authentication method | Standard OAuth via browser | OAuth with manual credential clearing |
| Token storage location | OS credential manager | OS credential manager + extension cache |
| Steps to change account | Not applicable | Sign out, clear credentials, sign in again |
| Risk of using wrong account | None | High — cached token persists |
You can now force VS Code to use the GitHub Copilot account you intend by clearing the cached authentication token and signing in fresh. After switching, open the Command Palette and run Copilot: Sign In to confirm the correct account is active. For teams that frequently switch between personal and work accounts, consider using a separate browser profile or the VS Code Settings Sync feature to keep extension configurations isolated.