Git Account Switcher by Revend Ltd
Works with - GitHub, - GitLab, - Forgejo, - Gitea, - Codeberg, - Bitbucket, - Self-hosted
Save multiple GitHub accounts and switch the active git / gh identity in one click — no more logging out and back in, no more broken git clone after a switch.
Marketplace ·
Website ·
Report a bug: hello@revend.ltd
Features
- Add multiple accounts — store as many GitHub identities as you need, each with a memorable label (e.g. Personal, Work, Open Source, Client Projects).
- One-click switch — selecting an account logs out the previous session, logs in with the stored token, and re-wires the git credential helper so that
git clone, push, and pull all use the correct identity immediately.
- GitLab, Forgejo / Gitea / Codeberg, Bitbucket, GitHub Enterprise & self-hosted — add any other git server with just its URL and an access token. The extension detects the server type, validates the token, picks up your username, and lists every repository the account can access for one-click cloning. Switching stores the token in git's credential store for that host, so HTTPS clone/push/pull just work.
- Accounts already signed in to VS Code — GitHub accounts from VS Code's Accounts menu that aren't saved yet are listed in the sidebar with Add / Add & switch buttons; no browser sign-in needed.
- Clone with any account — browse the account's repositories (GitHub API or the provider's API), pick one, choose a folder, done.
- Refresh token — re-authenticate any account through VS Code's GitHub sign-in flow without recreating the entry.
- Remove accounts — delete saved accounts individually from the sidebar panel (with a VS Code confirmation dialog).
- Sidebar Account Manager — a built-in panel shows all saved accounts, highlights the active one, and provides Switch, Clone, Refresh and Remove actions on every card.
- Zero setup — if the GitHub CLI (
gh) isn't on your machine, the extension downloads the official release for your OS into its own storage and uses it automatically. No PATH changes, no admin rights.
- Secure by default — tokens live in VS Code's encrypted
SecretStorage; nothing is written to disk in plain text.
Requirements
| Requirement |
Notes |
VS Code 1.110.0+ |
Uses the built-in GitHub authentication provider |
GitHub CLI (gh) |
Installed automatically if missing (or use your own via PATH / gitaccountswitcher.ghPath) |
| GitHub Authentication extension |
Ships with VS Code; required for OAuth sign-in |
Getting Started
- Install Git Account Switcher from the Marketplace (or from a
.vsix).
- The Git Account Switcher sidebar opens automatically the first time; afterwards click its icon in the Activity Bar to open the Account Manager. If the GitHub CLI isn't found you'll be offered a one-click Install automatically.
- Click Add Account, enter a label, then either Sign in with GitHub (browser sign-in — to add a different GitHub account, sign out of github.com in your browser first) or — for GitLab / Forgejo / Gitea / Codeberg / Bitbucket / self-hosted — enter the Server URL (e.g.
https://gitlab.com, https://git.example.com) and click Add with access token; paste a token when prompted (a link to the server's token page is shown).
- Repeat for each GitHub account you want to save.
- Click Switch on any card to activate that account for all
git and gh operations. The active account is highlighted and marked Active.
Adding GitLab, Forgejo/Gitea, Bitbucket or self-hosted accounts
- Add Account → label → Server URL (
https://gitlab.com, https://codeberg.org, https://bitbucket.org, https://gitlab.example.com, https://git.example.com:8443…) → Add with access token.
- A notification offers Open token page for that server. Create a token with repository read/write access:
- GitLab — Personal access token with
read_api + read_repository / write_repository
- Forgejo / Gitea / Codeberg — Access token with repository read (and write)
- Bitbucket — Atlassian API token entered as
email:api-token (Personal settings → API tokens, scopes Repositories: Read/Write), or a repository/workspace access token
- GitHub Enterprise — Personal access token (classic) with
repo
- Paste the token. The extension detects the server type — known hosts by name, custom domains by probing the server's API (works for self-hosted GitLab, Forgejo/Gitea and GitHub Enterprise on any domain) — validates the token and reads your username. Unreachable hosts, wrong URLs and TLS problems are reported distinctly from a rejected token. Tokens are stored in VS Code's encrypted
SecretStorage.
Switch puts the token into git's credential store for that host (git credential approve, using Git Credential Manager / osxkeychain / libsecret — configured automatically if you have none), so git clone, push and pull over HTTPS authenticate as that account. Clone lists all repositories the token can access. Refresh re-validates the token and lets you paste a new one if it expired.
Commands
All commands are available in the Command Palette (Ctrl+Shift+P / Cmd+Shift+P) under the Git Account Switcher category.
| Command |
Description |
Git Account Switcher: Open Account Manager |
Reveal the sidebar Account Manager panel. |
Git Account Switcher: Add GitHub Account |
Authenticate a new GitHub account (OAuth token) and save it. |
Git Account Switcher: Add GitHub Account Signed in to VS Code |
Save a GitHub account from VS Code's Accounts menu (re-uses its session; no browser). |
Git Account Switcher: Add GitLab / Gitea / Bitbucket / Self-hosted Account |
Save an account for any other git server using its URL and an access token. |
Git Account Switcher: Switch GitHub Account |
Switch the active gh / git session (GitHub) or the host's git credential (other servers) to a saved account. |
Git Account Switcher: Refresh GitHub Account |
Re-authenticate a saved account and update its token. |
Git Account Switcher: Delete GitHub Account |
Remove a saved account from the extension. |
Git Account Switcher: Clone Repository with Account |
Browse an account's repos from GitHub and clone the selected one. |
Git Account Switcher: Install GitHub CLI |
Download the latest GitHub CLI into the extension's storage (also updates an existing managed copy). |
Extension Settings
| Setting |
Default |
Description |
gitaccountswitcher.githubScopes |
["repo", "read:org"] |
OAuth scopes requested when authenticating a GitHub account. |
gitaccountswitcher.ghPath |
"gh" |
Path or command name for the GitHub CLI executable. Leave as gh to use gh from PATH — or, if none is found, the copy the extension installs itself. Set an explicit path (e.g. C:\Tools\gh.exe) to force a specific binary. |
How It Works
GitHub accounts — when you Switch the extension:
- Runs
gh auth logout --hostname github.com to clear any existing session.
- Pipes the stored token into
gh auth login --hostname github.com --with-token.
- Runs
gh auth setup-git to update the git credential helper so every subsequent git command uses the new account.
Other servers (GitLab, Forgejo/Gitea, Bitbucket, self-hosted) — when you Switch the extension replaces the stored git credential for that host (git credential reject + git credential approve with your token) and sets credential.https://<host>.username so git asks the helper for exactly that account. HTTPS git operations against that server then use the selected account. If you have no credential helper at all, a platform default is configured (manager / wincred / osxkeychain / libsecret / store). Removing an active account clears its stored credential.
Tokens are stored in VS Code's encrypted secret storage (SecretStorage API) — they are never written to disk in plain text.
Where does gh come from? The extension first looks for a gh you already have (on PATH and in the usual install locations). If none is found it offers to download the official release from github.com/cli/cli (~15 MB) into VS Code's global storage folder for the extension and runs it from there — the sidebar footer shows which gh is in use.
Token expiry is not artificially enforced. GitHub personal access tokens and OAuth tokens remain valid until you revoke them in GitHub → Settings → Developer settings. If a token stops working, use Refresh to obtain a fresh one.
Troubleshooting
Something failed? Every error is shown in the sidebar and logged to View → Output → "Git Account Switcher" (the error toast also has a Show log button). To report a bug, email hello@revend.ltd and include that log — email is the only support channel.
"GitHub CLI not found" — Run Git Account Switcher: Install GitHub CLI (or click Install GitHub CLI in the sidebar footer). Alternatively install the GitHub CLI yourself, or set gitaccountswitcher.ghPath to the full path of the executable.
"Switch succeeded but clone still fails" — Run git credential reject for the failing URL to clear any cached credentials, then retry. The gh auth setup-git step should prevent this in most cases.
"Adding a second GitHub account signs me into the first one again" — GitHub's browser sign-in re-uses whichever account your browser is logged into. Sign out of github.com in your browser (or use a private window), then click Add Account again. The extension reminds you of this and warns if GitHub hands back a user you already saved.
"forceNewSession not supported" — Older versions of the GitHub Authentication extension may not support forcing a new OAuth session. Update VS Code and its bundled extensions, or sign in to the desired account manually in VS Code's Accounts menu before using Add Account.
Release Notes
1.0.3
- Buy me a coffee banner is now a sticky footer pinned to the bottom of the sidebar (content scrolls beneath it).
- Bug reports go to hello@revend.ltd (mailto link) — GitHub Issues/Repository links removed from the README and the Marketplace listing.
- Marketplace description now reads "Works with - GitHub, - GitLab, - Forgejo, - Gitea, - Codeberg, - Bitbucket, - Self-hosted".
- README logo served from https://gitaccountswitcher.com so it renders on the Marketplace, GitHub and in VS Code.
1.0.2 — GitLab / Forgejo / Bitbucket accounts, VS Code accounts, smarter GitHub sign-in
What's new
- GitLab, Forgejo / Gitea / Codeberg, Bitbucket, GitHub Enterprise and self-hosted servers — add any git server with its URL and an access token. The server type is detected automatically (known hosts by name; custom domains by probing the server's API, so self-hosted GitLab / Forgejo / GHE on any domain work), the token is validated and your username filled in.
- Repository browser for every account — Clone lists all repositories the account can access (owned, collaborator, group / organisation) and clones the one you pick.
- Per-host git credentials — switching to a non-GitHub account stores its token in git's credential store for that host (Git Credential Manager / osxkeychain / libsecret / store, configured automatically if you have none), so HTTPS
clone / push / pull authenticate as that account. Removing an active account clears it again.
- Accounts already signed in to VS Code — GitHub accounts from VS Code's Accounts menu that aren't saved yet are listed in the sidebar with Add and Add & switch; they re-use the existing VS Code session, no browser needed.
- Adding a second GitHub account — the extension reminds you that GitHub's browser sign-in uses the account your browser is logged into (with an Open github.com sign-out shortcut) and warns if GitHub hands back a user you already saved instead of creating a duplicate.
- Token refresh — Refresh re-validates a provider token and lets you paste a new one if it expired; GitHub refresh re-authenticates the specific account.
- Resilient GitHub sign-in / switch — transient GitHub API failures (HTTP 5xx / 429, timeouts) during
gh auth login are retried automatically and reported clearly if they persist.
- Better errors — failures show in the sidebar (not just a toast) and are logged to the Git Account Switcher output channel; unreachable hosts, wrong URLs and TLS problems are reported distinctly from a rejected token.
- UI — the multi-provider form is a collapsible section under Sign in with GitHub; the header slogan links to https://gitaccountswitcher.com.
- New commands: Add GitLab / Gitea / Bitbucket / Self-hosted Account, Add GitHub Account Signed in to VS Code.
How to use it
- Another git server: Add Account → label → click or GitLab · Forgejo · Gitea · Codeberg · Bitbucket · self-hosted → enter the Server URL (
https://gitlab.com, https://codeberg.org, https://bitbucket.org, https://gitlab.example.com, https://git.example.com:8443) → Add with access token → click Open token page, create a token with repository read/write (scopes shown in the prompt; Bitbucket: email:api-token), paste it. Then Switch / Clone / Refresh / Remove on the card as usual.
- Account already in VS Code: scroll to Signed in to VS Code at the bottom of the sidebar → Add (or Add & switch) next to the account.
- Second GitHub account via browser: sign out of github.com in your browser first (or use a private window), then Add Account → Sign in with GitHub.
1.0.1
- Logo in the sidebar links to gitaccountswitcher.com.
- Added a Buy me a coffee banner at the bottom of the sidebar (and in this README) — https://buymeacoffee.com/revend.
- Display name is now Git Account Switcher by Revend Ltd.
1.0.0
- First release as Git Account Switcher (formerly published as GHAS 1.0.x) with the new logo, developed by Revend Ltd.
- Redesigned the sidebar Account Manager: new header with logo and tagline, inline New Account panel, richer account cards (icon tile, avatar, Active / Token saved badges) and a Switch / Clone / Refresh / Remove action row.
- Command Palette entries now live under the Git Account Switcher category.
- Clearer error message when the GitHub CLI cannot be found.
- The sidebar opens automatically on first run after install.
- The GitHub CLI is installed automatically when missing (
Install GitHub CLI command + sidebar footer status).
- Settings moved to
gitaccountswitcher.githubScopes / gitaccountswitcher.ghPath (previously ghas.*); accounts are stored per-extension, so re-add them after moving from GHAS.
GHAS 1.0.7
- Fixed the sidebar Remove button so it uses the same VS Code delete confirmation flow as the Delete GitHub Account command.
- Removed the webview
window.confirm dependency that could block UI deletion in some environments.
GHAS 1.0.6
Development
npm install
npm run compile # or: npm run watch
npm run package # builds the .vsix (requires @vscode/vsce)
Press F5 in VS Code to launch an Extension Development Host with the extension loaded.
Support & bug reports
Found a bug or need help? Email hello@revend.ltd — that's the only support channel (please attach the "Git Account Switcher" output log).
Git Account Switcher is free and open source. If it saves you time, you can keep it going with a coffee:
License
MIT — the full licence text ships with the extension (LICENSE) and is shown on the Marketplace listing.
Developed by Revend Ltd
| |