Home / Guides / How to use two GitHub accounts in VS Code on Mac
How to use two GitHub accounts in VS Code on Mac
“Two GitHub accounts in VS Code” is really two problems: which account Git commits and pushes as, and which account VS Code itself is signed into. They're fixed in different places.
Git and VS Code are two separate sign-ins
When you commit, Git stamps the commit with whatever user.name and user.email it finds in its config. When you push, it authenticates with an SSH key or a stored HTTPS credential. VS Code's own GitHub sign-in, the one Settings Sync, the Pull Requests extension and Copilot use, is a separate thing. Getting one right doesn't fix the other, so take them one at a time.
Commit as the right account in each folder
Keep work repositories under one folder (say ~/work) and tell Git to load a different identity there. In ~/.gitconfig:
[includeIf "gitdir:~/work/"]
path = ~/.gitconfig-work
Then put the work [user] name and email in ~/.gitconfig-work. Inside any repository under that folder, git config user.email now prints the work address, and everywhere else keeps your personal one.
Push with the right account
With SSH, give each account its own key and a host alias in ~/.ssh/config:
Host github-work
HostName github.com
User git
IdentityFile ~/.ssh/id_ed25519_work
IdentitiesOnly yes
Clone work repositories as git@github-work:org/repo.git (or change an existing remote to that form) and pushes use the work key. With HTTPS instead, git config --global credential.useHttpPath true makes the macOS Keychain store a credential per repository path rather than one for all of github.com.
Sign VS Code into two GitHub accounts
Since version 1.95 (October 2024), VS Code can be signed into more than one GitHub account at the same time, and each feature or extension uses the account you pick for it — one for Settings Sync and another for the Pull Requests extension, or one for pushing and another for Copilot. To add an account, start a sign-in from the feature that should use it and choose Use a new account…. VS Code's release notes warn that some extensions may not handle several accounts perfectly yet.
Profiles don't change this. A VS Code profile holds settings, keyboard shortcuts, snippets, tasks, MCP servers and extensions, and can switch automatically per folder. Accounts aren't on that list, so don't count on a profile to keep two GitHub sign-ins apart.
When you want two completely separate VS Codes
Sometimes you want the whole editor split: a client's VS Code with its own sign-ins, extensions and settings, nothing shared with yours. The code command can start VS Code with a separate data folder and extensions folder:
code --user-data-dir ~/vscode-client --extensions-dir ~/vscode-client-ext
Two catches. To macOS it's still the same app, with the same icon in the Dock. And extensions that run their own command-line tool keep that tool's account outside VS Code's folders: the Claude Code extension, for example, keeps its sign-in in ~/.claude and the login Keychain unless CLAUDE_CONFIG_DIR points it somewhere else.
A separate copy of the VS Code app solves both: its own Dock icon and colour, its own data and extensions. MacDupl builds that copy and sets CLAUDE_CONFIG_DIR per copy, so Claude Code inside it starts signed out and can hold a different account. Cursor and other VS Code family editors work the same way.
Questions
How do I check which account a commit will use?
Run git config user.email inside the repository. If it prints the wrong address, check that the repository sits under the folder named in your includeIf line, including the trailing slash.
Which account does Copilot use when VS Code is signed into two?
The one chosen for it. Each extension remembers its account preference, and VS Code lets you change that preference later without signing out of the other account.
Does a second VS Code need its own extensions?
With a separate extensions folder, yes: it starts empty and gets only what you install into it. That's what keeps a client's extensions out of your own editor.
Try it on your own Mac
The free trial classifies every app in your Applications folder instantly, so you can see exactly how a specific app is handled before paying anything.