Merge Multiple GitHub Accounts + Transfer Commit History

How to combine two (or many) GitHub user accounts into one, transferring repos and commit history.

• 1146 words

• By Scott Mathson

Managing multiple GitHub accounts can be frustrating. Let’s change that by consolidating and merging two (or multiple) GitHub accounts into one.

For years, I have had multiple GitHub user accounts and know of others who do, as well. Often this is different accounts with separation of personal and work projects. But I just consolidated into one account in an effort to make my git workflow more manageable. I’d recommend that you consider consolidating into one account, too.

Here’s how to do that!

Table of Contents:

Merging Two (or many) GitHub Accounts

It’s a relatively quick process to transfer repo ownership, manage (add/remove/change) account email addresses, and most importantly: keep/transfer any commit history to the profile’s contribution graph.

Throughout this article, I’ll refer to scottmathson-auth0 user account (“a”), consolidating into scottmathson user account (“b”).

During my user accounts combining/merging I was in contact with GitHub’s support team, who were excellent to talk with and I’ll note some of what they shared. Thanks again Matt!


How to Transfer Repository Owner on GitHub

There is no automated account data “export” functionality within GitHub, so you’ll need to start with manually transferring repository (repo) ownership account-to-account. Repo transfers between accounts includes all issues, pull requests, forks, stars, alongside automatic redirects being setup for git and http*.

“For merging two user accounts, I’m afraid there isn’t any automated process for this so you’re already on the right track with [manually] transferring your repositories.” - GH Support

This only requires a few steps.

During transferring repos account-to-account, it naturally lends towards cleaning house and deleting any stagnant or unmaintained repositories. Now would be a great time to do that.

- From Repo > Settings page > Options > scroll to the bottom, looking for red-colored “Transfer” button within the “Danger Zone”:

GitHub repository Settings Options panel
GitHub repository Settings Danger Zone - How to Transfer a repo

- Fill out the required fields, typing the name of the repository to confirm and entering the new owner’s GH username:

GitHub how to transfer a repository required form

- New owner receives an email with an auth token that expires after 24 hours. Be sure to check that email for the account you’re transferring to and follow the link to fully complete any repo transfers.

*Even though it will redirect automatically, it is recommended that you update your remote’s origin URL once the transfer is complete: git remote set-url origin new_url

Refer to this documentation from GitHub if you’re looking to transfer a repo owned by an Organization.


Account Email Management on GitHub + Git Commit History

Git commit history, SAML, and other items are tied to the email(s) you have on-file within GitHub and in your remote, local setup. When consolidating multiple GitHub accounts into one, this is an essential step to cover to ensure you keep any commit history + have it added to contribution graph on user profile.

Account email management also ensures you are able to fully accept certain Organization invites.

“…effectively once you finalize the data transfer, your commits will be reattributed once the email address on scottmathson-auth0 is added (and verified) on scottmathson. For related contributions, these will be updated as well subject to certain criteria” - GH Support

Pull requests and issues fall under this “certain criteria” grey area. Most commit history will transfer once the email address that authored those commits have been added to your account. With the exception/caveat of losing pull requests and issues commit histories, more on this below.

How to add/verify one (or many) email addresses to your GitHub account:

- From GH dashboard > Click your profile photo dropdown > Settings page:

GitHub dashboard profile Settings dropdown

- Click on Emails in the left sidebar > Add email address field > Add new email:

GitHub user account add new email address

- Check your inbox for the email address you’ve just added and click the link included. You should land on your GitHub dashboard, seeing an email verification confirmation banner.

GitHub email address verification confirmation

More regarding PRs and issues: any contributions/commits within PRs and issues by account “a” scottmathson-auth0 did not transfer. GitHub support explains this as, “…would instead be attributed to our “Ghost” user once the account is deleted, though the issues/PRs themselves would otherwise be unaffected.”.

Do keep this in mind! Though you can add an assignee for any open PRs/issues to the account you’re transferring data to, certain contributions will not transfer.

Any emails that you’ve been actively using in your local git configuration should be added to your GitHub account email settings in order for commits to be re-attributed and added to graph.

With the newly-verified email address(es) added, you can now authenticate and accept Organization invites after you’ve removed any emails associated with SSO and SAML from the stagnant account, account “a” scottmathson-auth0.

Allow GitHub a bit of time to propagate the history and contributions between accounts.


Again, managing multiple GitHub user accounts can be frustrating and I’ve personally combined accounts for a more effective workflow and portfolio. At one point shortly after starting to use GitHub, in an effort to have consistency in my usernames/email across platforms (using @scottmathson on social), I completely deleted a GitHub account and created a new one.

Looking back, I could and should have simply changed the username and added a new email to accomplish the goal I was after. I could have gone through the processes outlined above to transfer repos, instead of downloading/organizing/re-doing so locally and then creating new repo origins. Obviously, I effectively wiped all public contributions and history of that first user account.

I hope this article has helped, please pass it along if so. Thanks for reading!


In the case that you have multiple GitHub accounts and want to keep everything as-is and this article wasn’t for you, thanks for reading this far and check out this article from freeCodeCamp showing how to manage multiple GH accounts on one machine with SSH keys.


Having any issues? Feel free to reach out @scottmathson on Twitter and/or read more from GitHub: Why are my contributions not showing on profile graph?

chevronLeft icon Previous Next chevronRight icon