GH AccountsManage your GitHub CLI accounts from VS Code. GH Accounts helps you move between personal, work, and GitHub Enterprise accounts while keeping the active account easy to find. What you can do
Before you startYou need VS Code 1.95 or newer, GitHub CLI installed, and a workspace you trust. GH Accounts does not install GitHub CLI for you. If you work over SSH, WSL, Dev Containers, or Codespaces, GitHub CLI and GH Accounts need to be available in that remote environment. See Remote workspaces below. Get started
GitHub CLI may offer to configure Git during sign-in. Accept that prompt only if you want it to change how Git authenticates. To add another account, repeat Add Account and sign in with the other account in your browser. You can also open the Command Palette and search for GH Accounts to find the commands below. Switch accounts
You can also use the Switch Account action beside an account in the sidebar, or run GH Accounts: Switch Account. Switching changes the shared GitHub CLI account for that host. Other terminals and workspaces using the same GitHub CLI configuration can use the newly selected account. It does not create a separate account for each workspace or change your Git commit name, email, or SSH identity. Read the status barWith accounts on one GitHub host, the status bar shows the active username, such as GH Accounts: alice. With several hosts, it shows a host count, such as GH Accounts: 2 hosts. That count includes hosts without an active or healthy account. Hover over it for full usernames and hosts, local aliases, authentication health, environment-token overrides and the local or remote environment being managed. Long usernames are shortened in the status bar and shown in full in the tooltip. Click it to choose or manage an account. A loading indicator means an account check or operation is in progress. (last known) means the displayed data is stale; select Refresh to verify it. Environment token means an override is present but its effective username is unknown. Check accounts means the active identity is ambiguous; open the picker and inspect the account list. These labels work with profile details enabled or off. Open a profile or copy a usernameRight-click an account and select Open GitHub Profile or Copy Username. You can also choose the account from the GH Accounts status-bar menu, or run GH Accounts: Open GitHub Profile or GH Accounts: Copy Username from the Command Palette. The profile opens in your browser on the account's GitHub.com or Enterprise host. Copy Username copies just the username, without the host or profile URL. Both actions work with usernames already shown in the list, even if an authentication check fails or an environment token overrides saved credentials. They are unavailable for identities whose username is unknown. Show display names and avatarsThis optional feature is off by default.
The setting applies to the local or remote environment running GH Accounts. It is not synced between machines, and workspace settings cannot enable it. Profile lookup uses the current GitHub CLI authentication for each host. Some accounts may be hidden from that credential. If a name or picture cannot load, you can still manage the account normally. Select Refresh to retry; recent failures have a short retry delay. Avatars make additional HTTPS requests. Supported pictures are small PNG or JPEG images from the account's host, or GitHub's avatar service for GitHub.com. Enterprise pictures hosted elsewhere, requiring sign-in, or requiring a custom proxy or certificate configuration may keep the regular account icon. Details are temporary and may take up to 15 minutes to refresh. Downloaded pictures are stored temporarily in the same local or remote environment. Turning avatars off removes this window's pictures; files left by an interrupted shutdown may remain until later cleanup. Clear cached profile details
Clearing applies only to this window's cache in the local or remote environment running GH Accounts. Other windows keep their own caches. If cached pictures cannot be deleted, the extension keeps them hidden and shows an error; try Clear Profile Cache again. Add a local account alias
Use Set Account Alias again to edit a label, or Remove Account Alias to remove it. The Command Palette also provides GH Accounts: Remove Account Alias. Aliases work even when profile details are off or an authentication check fails. They label a known username on one GitHub host, including known environment-token identities. They do not rename your GitHub account or change sign-in, Git credentials, or commit author settings. Labels are saved in the local or remote environment running GH Accounts. They are shared with other GH Accounts windows using that storage and are not synced to other machines. Select Refresh to see labels changed in another window. Signing out keeps the label for when you add the same account again; use Remove Account Alias to delete it. Configure Git credentials for a hostUse this when you want Git HTTPS operations to authenticate through GitHub CLI.
The host needs an active saved account whose authentication check succeeded. Git will use the active GitHub CLI account; this action does not switch accounts or change your commit name, email, or SSH identity. Other repositories using the same Git credential settings can be affected. If setup fails or is cancelled after starting, Git settings may already have changed. Check your Git credential settings before retrying. Previous settings are not backed up or automatically restored. Log outUse Log Out beside an account, or run GH Accounts: Log Out, choose the account, and confirm Log Out. This removes its saved GitHub CLI sign-in from the current environment. It does not revoke the token on GitHub. If another account remains on that host, GitHub CLI may make it active. Remote workspacesIn an SSH, WSL, Dev Container, or Codespaces workspace, GH Accounts manages accounts in that remote environment, which may differ from your desktop accounts. Check the view's Local or Remote: label before making changes. GH Accounts requires a local or remote workspace. Restricted Mode, virtual workspaces, and browser-only sessions without a remote workspace are not supported. Troubleshooting
HelpFor an explanation of account sharing and token overrides, run GH Accounts: About Shared Accounts and Environment Tokens. For GitHub CLI commands and sign-in help, see the official GitHub CLI manual. |