DEV Community

Cover image for How to Effortlessly Manage Multiple Accounts in GitHub Desktop (macOS)

How to Effortlessly Manage Multiple Accounts in GitHub Desktop (macOS)

** Disclaimer:**This guide and the accompanying scripts were generated with the assistance of AI. While the workflow has been tested, please double-check all terminal commands and scripts before running them on your own system!

If you use GitHub Desktop, you probably love its clean UI and seamless conflict resolution. But if you are a freelancer, an agency developer, or just someone juggling personal and work repositories, you’ve definitely hit its biggest limitation: GitHub Desktop does not natively support multiple accounts.

While there is a massive official feature request for this that has been active for years, the maintainers unfortunately have it tagged as not-planned for the foreseeable future.

If you want to switch from your personal account to a client’s account, you have to manually sign out, sign back in, and re-configure your Git identity every single time.

After getting frustrated with this, I built a fully automated terminal workflow for macOS that lets you swap GitHub Desktop profiles and Git identities in a split second using a single command.

Here is how you can set it up.

The Core Concept: The Symlink Trick

(Credit where credit is due: The foundational idea of swapping configuration folders via symlinks was inspired by this clever Stack Overflow answer . I’ve expanded on that concept here to include global Git identity swapping and a fully automated profile generation script.)

GitHub Desktop stores all of its session data, login tokens, and preferences in this directory: ~/Library/Application Support/GitHub Desktop

By renaming this folder (e.g., to GitHub Desktop.config1) and creating a symbolic link (symlink) in its place, we can trick the application into loading different profiles whenever we swap the symlink out.

Even better, we can chain this with standard git config commands so that your commits always use the correct email address for the active profile!

Step 1: Add the Automation to Your .zshrc

Instead of doing this manually every time, we are going to add aliases and a smart bash function to your terminal configuration.

Open your terminal and edit your zsh configuration file:

nano ~/.zshrc

#
# =========================================================  
#
# 1. GITHUB DESKTOP & GIT IDENTITY SWITCHERS  
#
# =========================================================  
alias gitpersonal='ln -nfs "$HOME/Library/Application Support/GitHub Desktop.config1" "$HOME/Library/Application Support/GitHub Desktop" && git config --global user.name "Your Name" && git config --global user.email "personal@email.com" && echo "Switched to Personal Profile (Config 1)"'  
alias gitwork='ln -nfs "$HOME/Library/Application Support/GitHub Desktop.config2" "$HOME/Library/Application Support/GitHub Desktop" && git config --global user.name "Work Name" && git config --global user.email "work@company.com" && echo "Switched to Work Profile (Config 2)"'  
#
# =========================================================  
#
# 2. PROFILE MANAGEMENT AUTOMATION  
#
# =========================================================  
#
# Command to un-link and prepare for a fresh login  
alias gitnew='rm "$HOME/Library/Application Support/GitHub Desktop" && echo "Delinked! Open GitHub Desktop to set up a fresh profile."'  
#
# Command to save a newly created profile and generate an alias automatically  
gitsave() {  
  if [ -z "$1" ]; then  
    echo "Usage: gitsave <alias_name> (e.g., gitsave gitclient)"  
    return 1  
  fi  
  local target_dir="$HOME/Library/Application Support/GitHub Desktop"  

  if [ -L "$target_dir" ] || [ ! -d "$target_dir" ]; then  
    echo "Error: No fresh setup found. Run 'gitnew', log in, close app, and try again."  
    return 1  
  fi  
  echo "Enter Git User Name for this profile (e.g., John Doe):"  
  read git_name  
  echo "Enter Git Email for this profile (e.g., john@example.com):"  
  read git_email  
  local num=1  
  while [ -d "${target_dir}.config${num}" ]; do  
    ((num++))  
  done  
  mv "$target_dir" "${target_dir}.config${num}"  

  local alias_cmd="alias $1='ln -nfs \"\$HOME/Library/Application Support/GitHub Desktop.config${num}\" \"\$HOME/Library/Application Support/GitHub Desktop\" && git config --global user.name \"$git_name\" && git config --global user.email \"$git_email\" && echo \"Switched to ($1) Config ${num}\"'"  

  echo "" >> ~/.zshrc  
  echo "$alias_cmd" >> ~/.zshrc  

  source ~/.zshrc  
  echo "✅ Saved current profile as config${num} and added alias '$1' to .zshrc!"  
}
Enter fullscreen mode Exit fullscreen mode

Save the file (Ctrl + O, Enter, Ctrl + X) and reload your terminal:

source ~/.zshrc
Enter fullscreen mode Exit fullscreen mode

Step 2: How to Use Your New Superpowers

Now that the code is in place, managing your accounts is incredibly simple.

Switching Between Existing Profiles

Ensure GitHub Desktop is closed. Open your terminal and type your alias:

gitwork
Enter fullscreen mode Exit fullscreen mode

Boom. You are now logged into your work account, and any commits you make will automatically be attributed to your work email. Need to switch back? Close the app, type gitpersonal, and you're done.

Adding a Brand New Profile (The Magic Workflow)

This is where the gitsave function shines. Let's say you just landed a new freelance client and need a dedicated GitHub account for them.

  1. Close GitHub Desktop.
  2. Run gitnew in your terminal. (This safely unlinks your current profile).
  3. Open GitHub Desktop. It will act like a brand-new installation! Log into your new client account and set up your preferences.
  4. Close GitHub Desktop.
  5. Run your save command with whatever shortcut name you want to use: gitsave gitclient
  6. The terminal will ask you for the Git Name and Email you want to associate with this specific client.

The script will automatically move the folder to the next available slot (like config3), dynamically write the new alias into your .zshrc file, and reload your terminal. You can now type gitclient anytime you want to work on their codebase!

Wrapping Up

Until GitHub officially supports multi-account management in their desktop client, this symlink trick is an absolute lifesaver. It keeps your identities perfectly separated and completely removes the friction of logging in and out.

Let me know in the comments if this workflow helped you clean up your Git environment! 🚀

Top comments (0)