• GitHub
  • GitHub Desktop
  • Git
  • authentication

Assign each GitHub Desktop repository to the right account

GitHub Desktop 3.7.0 supports several accounts on one host. A beginner's step-by-step guide to assigning an account per repository, setting the right commit email per folder with includeIf, and checking both.

Many developers have two GitHub accounts: a personal one for side projects and a work one that belongs to their employer. Until recently, GitHub Desktop remembered only one account per host. Pushing to a work repository after a personal one could mean signing out and back in.

GitHub Desktop’s November 19, 2026 changelog says version 3.7.0 supports multiple accounts on the same host and lets each repository use a selected account. GitHub Desktop release notice, November 19, 2026

This guide explains what that setting does, what it does not do, and how to make your commits carry the right email for each account. The second part is the one people usually miss.

Two different identities

When you work with GitHub, two separate identities are involved. It helps to name them before touching any settings.

The account that connects to GitHub. This is who you are signed in as. GitHub checks it when you push (upload commits), pull or fetch (download commits), or when the app calls the GitHub API (the web interface programs use to read issues, pull requests and so on). If this account has no access to a private repository, the push fails.

The author written into each commit. A commit is a saved snapshot of your changes. Git stores a name and an email inside every commit. These come from Git’s own configuration, the user.name and user.email settings, not from the account you signed in with.

GitHub Desktop’s documentation states this directly: the account assigned to a repository is used for GitHub API requests and HTTPS Git operations, and it “doesn’t change the name and email address that Git uses as the author of your commits.” GitHub Desktop multi-account documentation

So a correct setup needs both: the right account for the connection, and the right email for the commits.

Part 1: assign an account to each repository

Step 1: sign in to each account

The release notice names GitHub.com, GitHub Enterprise Server and GHE.com as supported hosts, with no fixed limit to the number of accounts per host.

  1. Open Settings (macOS) or Options (Windows).
  2. Choose Accounts.
  3. Sign in with your second account.

Repositories you already had stay assigned to the account they were using.

Step 2: choose the account when you clone or add a repository

GitHub Desktop assigns an account when you clone, add or publish a repository. “Clone” means downloading a copy of a repository from GitHub to your computer.

  • If only one of your signed-in accounts can access the repository, Desktop assigns that account automatically.
  • If several accounts can access it, Desktop asks you to choose.
  • Public repositories are a special case. Every account can read a public repository, so when you are signed in to more than one account on that host, Desktop always asks you to pick one.
  • If none of your accounts can access a private repository, cloning it over HTTPS fails until you sign in with an account that has access.

For a public repository, pick the account you would use to push or open pull requests. It is easy to click through this prompt without thinking.

Step 3: change or remove the assignment later

Open Repository Settings and go to the Remote pane. Pick a different account there, or click None (unassigned) to remove the assignment. You can also change it from the repository list. Account assignment in the docs

A note on SSH remotes

A remote is the address Git pushes to and pulls from. It can use HTTPS (https://github.com/org/repo.git) or SSH (git@github.com:org/repo.git).

The documentation describes the account assignment for API requests and HTTPS Git operations. It does not mention SSH. With an SSH remote, Git authenticates with an SSH key, as it does outside Desktop, so the key decides which GitHub account you act as. If a repository uses SSH, check your SSH key setup instead of the account picker.

Part 2: use the right commit email in each folder

The account picker does not set your commit email. If your global Git configuration has your personal email, your work commits will carry it too. Git can solve this by folder.

Why a folder rule works

Git reads configuration from several files. The global file, usually ~/.gitconfig, applies to every repository for your user. An [includeIf] section tells Git to load another file only when a condition is true. The gitdir: condition matches the location of the repository.

So the plan is: keep work repositories under one folder, such as ~/work/, and load a work email only there.

Step 1: put work repositories in one folder

Clone or move work repositories into ~/work/. In GitHub Desktop you choose the local path when you clone. Personal repositories can live anywhere else.

Step 2: add the rule to your global configuration

Open ~/.gitconfig in a text editor and add the last two lines:

[user]
	name = Alex Example
	email = alex@personal.example
[includeIf "gitdir:~/work/"]
	path = ~/.gitconfig-work

The trailing slash in ~/work/ matters. It makes the rule match every repository inside that folder.

Step 3: create the work file

Create ~/.gitconfig-work with only the setting that changes:

[user]
	email = alex@company.example

Values in the included file override the ones above it, so work repositories get the work email and keep the same name.

Step 4: check which file wins

Run these commands in a terminal, inside a repository folder. --show-origin prints which file each value came from.

I tested this with Git 2.54.0 on macOS, using a temporary home folder so my real configuration was untouched. In a repository under ~/work/:

$ git config --show-origin --get user.email
file:~/.gitconfig-work	alex@company.example
$ git commit --allow-empty -m test
$ git log -1 --format='%an <%ae>'
Alex Example <alex@company.example>

In a repository outside that folder:

$ git config --show-origin --get user.email
file:~/.gitconfig	alex@personal.example
$ git log -1 --format='%an <%ae>'
Alex Example <alex@personal.example>

Git printed the full path of the temporary home folder; it is shortened to ~ here. The empty commit was made in a throwaway repository only to give git log something to show. In a real repository, run git config --show-origin before committing and check git log after your next real commit.

The includeIf rule is plain Git configuration, so it applies to any tool that runs Git in that folder. Making a commit in GitHub Desktop and checking it with git log is a quick way to confirm Desktop picks it up on your machine.

Common mistakes

  • Assuming the account picker sets the email. It does not. Check git log -1 --format='%an <%ae>' after your first commit.
  • A local override. A user.email set inside one repository (git config user.email ... without --global) beats the folder rule. --show-origin shows .git/config as the source when that happens.
  • Missing trailing slash. In the same test, gitdir:~/work without the slash did not match ~/work/app, and the personal email was used. Git’s documentation explains that a trailing / makes the pattern match everything inside the folder. Git includeIf documentation
  • Repository in the wrong folder. The rule follows the folder, not the remote URL. A work repository cloned into ~/Downloads/ gets the personal email.
  • Picking the wrong account for a public repository. Desktop asks every time; reopen Repository Settings if you chose wrong.

Check both before you push

  1. In Repository Settings, Remote pane, confirm the assigned account.
  2. In a terminal inside the repository, run git config --show-origin --get user.email.
  3. After the first commit, run git log -1 --format='%an <%ae>'.
  4. If a push asks for credentials, check that the assigned account is still signed in and has access.

Conclusion

GitHub Desktop’s repository account decides who connects to GitHub for API calls and HTTPS pushes and pulls. Git’s user.email decides who appears as the commit author. Set the first in Repository Settings, set the second per folder with includeIf, and check both with --show-origin and git log before your first push.

Written by Duy Pham Independent developer. I build the apps on this site and write about how they work.

More about me