
The Developer’s Guide to Managing Multiple GitHub Accounts on Mac in 2026
If you’re a developer who contributes to open-source with a personal GitHub account while also pushing code to a company organization with a work account, you know the pain of trying to manage multiple GitHub accounts mac setups. One wrong commit and your personal email shows up in your company’s repo — or worse, your push gets rejected because the wrong SSH key was used.
This comprehensive guide walks through every method to properly configure multiple GitHub accounts on macOS in 2026, from SSH key management to per-repository git configurations and automation tools that eliminate the daily friction.
Why Developers Need Multiple GitHub Accounts
The most common scenarios requiring multiple accounts:
- Work + Personal: Company GitHub organization alongside personal open-source projects.
- Freelance clients: Different client organizations requiring separate GitHub identities.
- Teaching/Demo accounts: Separate accounts for tutorials, workshops, and demo repositories.
- Bot/Service accounts: GitHub accounts for CI/CD pipelines, deployment bots, or automation.
- Organization compliance: Some companies require all commits use a company email address.
- Open-source pseudonym: Contributing anonymously to sensitive or controversial projects.
Method 1: SSH Keys — The Gold Standard
The most robust way to manage multiple GitHub accounts mac setups is using separate SSH keys for each account, configured via the SSH config file.
Step 1: Generate SSH Keys for Each Account
Open Terminal and create a key for each GitHub account:
For your personal account:
ssh-keygen -t ed25519 -C "[email protected]" -f ~/.ssh/id_ed25519_personal
For your work account:
ssh-keygen -t ed25519 -C "[email protected]" -f ~/.ssh/id_ed25519_work
Use a strong passphrase for each key. The ed25519 algorithm is recommended over RSA for better security and performance.
Step 2: Add Keys to the SSH Agent
Start the SSH agent and add both keys:
eval "$(ssh-agent -s)"
ssh-add --apple-use-keychain ~/.ssh/id_ed25519_personal
ssh-add --apple-use-keychain ~/.ssh/id_ed25519_work
The --apple-use-keychain flag stores the passphrase in macOS Keychain, so you won’t be prompted every time.
Step 3: Configure SSH Config File
Create or edit ~/.ssh/config:
# Personal GitHub account
Host github-personal
HostName github.com
User git
IdentityFile ~/.ssh/id_ed25519_personal
IdentitiesOnly yes
AddKeysToAgent yes
UseKeychain yes
# Work GitHub account
Host github-work
HostName github.com
User git
IdentityFile ~/.ssh/id_ed25519_work
IdentitiesOnly yes
AddKeysToAgent yes
UseKeychain yes
The key here is IdentitiesOnly yes — this tells SSH to only offer the specified key, preventing authentication confusion.
Step 4: Add SSH Keys to GitHub
- Copy the personal key:
pbcopy < ~/.ssh/id_ed25519_personal.pub - Go to GitHub → Settings → SSH and GPG keys → New SSH key → Paste.
- Repeat for the work key on the work GitHub account.
Step 5: Test the Connection
ssh -T github-personal → Should say “Hi [personal-username]!”
ssh -T github-work → Should say “Hi [work-username]!”
Step 6: Clone Repositories with the Correct Host
Instead of using the standard GitHub clone URL, substitute the Host alias:
Personal repo: git clone git@github-personal:username/repo.git
Work repo: git clone git@github-work:company/repo.git
For existing repos, update the remote URL:
git remote set-url origin git@github-work:company/repo.git
Method 2: Git Configuration for Correct Author Identity
SSH keys handle authentication, but you also need to ensure the correct name and email appear on commits.
Global Git Config
Set your default (most frequently used) identity globally:
git config --global user.name "Your Name"
git config --global user.email "[email protected]"
Per-Repository Override
In each work repository, override the global config:
cd ~/work/company-repo
git config user.name "Your Work Name"
git config user.email "[email protected]"
Conditional Includes (The Best Approach)
Git supports conditional includes based on directory, which automates the name/email switching. Add to ~/.gitconfig:
[user]
name = Your Name
email = [email protected]
[includeIf "gitdir:~/work/"]
path = ~/.gitconfig-work
Then create ~/.gitconfig-work:
[user]
name = Your Work Name
email = [email protected]
Now any repository under ~/work/ automatically uses work credentials, and everything else uses personal credentials. This is the cleanest solution for developers who organize projects by directory.
Method 3: GitHub CLI (gh) with Multiple Accounts
The GitHub CLI tool now supports multiple account profiles:
Setting Up Multiple Accounts
- Authenticate your first account:
gh auth login - Switch accounts:
gh auth switch - Or set a specific account per repository using environment variables.
Git Extensions and GUIs
Many Git GUI tools support multiple account configurations:
- GitKraken: Built-in profile switching with associated SSH keys.
- Tower: Per-repository accounts in preferences.
- Fork: SSH key selection per remote.
- SourceTree: Account management in settings.
Method 4: HTTPS with Credential Manager
If you prefer HTTPS over SSH, macOS Keychain can manage credentials:
Using Personal Access Tokens (PATs)
- Generate a PAT for each account: GitHub → Settings → Developer settings → Personal access tokens.
- When cloning or pushing via HTTPS, enter the PAT as your password.
- macOS Keychain stores the credential per repository URL.
Managing Multiple PATs
The challenge with HTTPS is that macOS Keychain stores one credential per domain (github.com). Workarounds include:
- Using the
osxkeychaincredential helper with URL-based differentiation. - Embedding the PAT in the remote URL (not recommended for security reasons).
- Using Git Credential Manager Core with namespace support.
SSH keys remain the recommended approach for multi-account management on Mac.
GPG Signing with Multiple Accounts
For verified commits on both accounts, configure GPG signing per identity:
Generate GPG Keys
- Create a GPG key for each email:
gpg --full-generate-key - Add each GPG public key to the respective GitHub account.
- Configure per-repository signing:
git config user.signingkey ABCDEF1234567890
git config commit.gpgsign true
With conditional includes, GPG signing keys automatically switch based on repository location — matching the correct signing key to the correct email.
Directory Organization Strategy
The foundation of a clean multi-account Mac setup is directory organization:
~/
├── personal/ # All personal projects
│ ├── open-source/ # Open-source contributions
│ ├── side-projects/ # Personal apps and experiments
│ └── dotfiles/ # Personal configuration
├── work/ # Work repositories
│ ├── team-repos/ # Team shared repositories
│ ├── infrastructure/ # DevOps and infra repos
│ └── docs/ # Documentation
└── freelance/ # Client work
├── client-a/ # Client A repositories
└── client-b/ # Client B repositories
This structure pairs perfectly with Git’s conditional includes, automatically applying the correct identity based on where the repository lives.
Common Problems and Fixes
Problem: “Permission denied (publickey)”
This usually means the wrong SSH key is being offered. Fixes:
- Verify the correct Host alias is used in the remote URL.
- Check that the SSH key is added to the agent:
ssh-add -l - Ensure
IdentitiesOnly yesis set in SSH config. - Test the connection:
ssh -vT github-work(verbose mode shows which key is tried).
Problem: Commits Show Wrong Email
Check the effective configuration for the current repo:
git config user.email
If it shows the wrong email, set it at the repository level or fix your conditional includes.
Problem: SSH Agent Forgets Keys After Reboot
Add to ~/.ssh/config:
Host *
AddKeysToAgent yes
UseKeychain yes
This tells macOS to persist SSH keys in Keychain across reboots.
Problem: Cloned Repo Using Wrong Account
Update the remote to use the correct SSH Host alias:
git remote set-url origin git@github-personal:username/repo.git
Browser-Based GitHub Account Management
For GitHub’s web interface (PRs, issues, project boards), you’ll need separate browser sessions:
- Browser profiles: Create Chrome/Safari profiles for each GitHub account.
- Cloud sessions: For complete isolation, use cloud-based browser sessions that keep each GitHub identity separate.
- Incognito mode: Quick access to a second account, but you’ll need to log in each time.
Using proper multi-account management for both the terminal (SSH/Git) and the web interface (browser) ensures a seamless workflow.
Automation and Shell Aliases
Speed up your multi-account workflow with shell aliases and functions:
Useful Aliases for ~/.zshrc
# Quick identity check alias gitid='echo "$(git config user.name) <$(git config user.email)>"' # Switch to work identity for current repo alias gitwork='git config user.name "Work Name" && git config user.email "[email protected]"' # Switch to personal identity for current repo alias gitpersonal='git config user.name "Personal Name" && git config user.email "[email protected]"' # Clone with work account alias gclonew='git clone $(echo $1 | sed "s/github.com/github-work/")' # Clone with personal account alias gclonep='git clone $(echo $1 | sed "s/github.com/github-personal/")'
Pre-Commit Hook for Email Verification
Add a pre-commit hook that warns if you’re about to commit with the wrong email:
Create .git/hooks/pre-commit in important repos to check the email before each commit and abort if it doesn’t match the expected pattern. This catches identity mistakes before they reach the remote repository.
CI/CD and Deploy Keys
For automated workflows across multiple accounts:
Deploy Keys
- Deploy keys are SSH keys tied to a specific repository, not an account.
- Generate a unique deploy key per repository that CI/CD needs to access.
- Add the public key to the specific repo under Settings → Deploy keys.
- This avoids using personal account keys in automation.
GitHub Apps
For organization-level access across multiple repos, GitHub Apps provide:
- Fine-grained permissions.
- Installation tokens that don’t tie to any personal account.
- Audit trails separate from human users.
Security Best Practices
SSH Key Security
- Always use passphrases on SSH keys — let Keychain manage them for convenience.
- Use ed25519 keys (not RSA) for modern security standards.
- Rotate keys annually or when team members change.
- Never share private keys between devices — generate new keys per machine.
Account Security
- Enable two-factor authentication on every GitHub account.
- Use hardware security keys (YubiKey) for the highest protection.
- Review authorized OAuth apps and SSH keys quarterly.
- Set up secure browsing practices for web-based GitHub access.
How Send.win Helps You Master Manage Multiple Github Accounts Mac
Send.win makes Manage Multiple Github Accounts Mac simple and secure with powerful browser isolation technology:
- Browser Isolation – Every tab runs in a sandboxed environment
- Cloud Sync – Access your sessions from any device
- Multi-Account Management – Manage unlimited accounts safely
- No Installation Required – Works instantly in your browser
- Affordable Pricing – Enterprise features without enterprise costs
Try Send.win Free – No Credit Card Required
Experience the power of browser isolation with our free demo:
- Instant Access – Start testing in seconds
- Full Features – Try all capabilities
- Secure – Bank-level encryption
- Cross-Platform – Works on desktop, mobile, tablet
- 14-Day Money-Back Guarantee
Ready to upgrade? View pricing plans starting at just $9/month.
FAQ: Managing Multiple GitHub Accounts on Mac
Can I be logged into two GitHub accounts in one browser?
Not in the same browser profile. Use separate Chrome profiles or cloud browser sessions to maintain parallel GitHub sessions.
Does GitHub allow multiple accounts?
GitHub’s Terms of Service allow one free personal account. However, you can have additional accounts for organizations, bots, or when your employer provides one. Check GitHub’s ToS for current policy.
What if I accidentally committed with the wrong email?
For the most recent commit: git commit --amend --author="Name <[email protected]>". For older commits, use git rebase -i or git filter-repo (destructive — only on unpushed commits).
SSH vs HTTPS — which is better for multiple accounts?
SSH is clearly better for managing multiple GitHub accounts on Mac. SSH keys are per-account and per-file, while HTTPS credentials are per-domain, making it harder to separate accounts.
How do I handle GitHub notifications for multiple accounts?
Configure notification settings independently on each account. Use email filters to route notifications from different GitHub accounts to different folders. The GitHub mobile app supports multiple account login.
Can I use the same SSH key for two GitHub accounts?
No. GitHub requires each SSH key to be unique to one account. You must generate separate SSH key pairs for each GitHub account. This is by design — it prevents account confusion.
Conclusion
Once properly configured, the ability to manage multiple GitHub accounts mac setups becomes seamless and transparent. The combination of SSH Host aliases, conditional git includes, and organized directory structures means you never have to think about which account you’re using — the configuration handles it automatically.
Invest 30 minutes in setting up the SSH keys and directory structure described in this guide, and you’ll save hours of frustration from wrong-account commits, failed pushes, and identity confusion. The initial setup pays for itself within the first week of multi-account development work.
