There is unfortunately no easy way to merge two accounts into one on GitHub. Since I was doing so myself a while back and now a few people have asked me how to do it, I thought that I could just write up a quick guide on how to do it.
Disclaimer: I am in no way responsible for the changes, you will be 100% responsible for the changes you make to your account(s).
TL;DR? Jump down to "Your Most Priced Possessions"-section!
Ok, so let's start with what you can expect to lose and what you can move from one account to the other. This list might not be complete this is what I have noticed during this process.
What you will lose
- Your followers
- Saved sign-ins to 3rd-party apps
- Personal access tokens
What you can transfer
- Profile picture
- Commit history
- SSH Keys
- GitHub Apps
- And more...
How to merge two GitHub accounts
Firstly open two windows (one incognito and one normal) of your favourite browser or even two different browsers. Then log in to both of your GitHub accounts. Let's call the account we want to keep Account A and the other one, the one we do not want to use, Account B.
Your Profile and Account Settings
For Account A you should make sure that your account is properly filled out with the personal information from Public Profile you would like to keep. Compare both of the accounts side-by-side.
Do the same for these setting pages, the most important ones in my opinion;
These might not too important for you, but you might have done some custom settings from the default ones.
"Billing and plans"
This is where you cannot move stuff from one account to the other. So if you have a subscription to GitHub Pro, sponsor any companies or persons or even have enabled any Add-ons, you should have to add that to Account A from Account B.
"Password and authentication"
If you have set up 2FA, I hope you have, you should enable that on Account A.
"SSH and GPG keys"
If you have set up any keys here you should find the public keys for these and add them to Account A.
In case you are a member of any organisation on Account B you would need to contact one of the owners/admins of that organisation to add you back with Account A.
Make sure that you transfer ownership of any GitHub Apps from Account B. Personal access tokens cannot be transferred, so you will have to create and set up these again on Account A.
Your Most Priced Possessions
Ok, that was it for the actual profile. Now onwards to the most important part, the code, more specifically the repositories and commit history. Let's start with the repositories.
For your personal repositories, you need to open each one of these on Account B and go into "Settings" in the repository. Scroll down to the bottom of the "General" page and click the "Transfer"-button. You will get a pop-up asking for an organisation name or username, enter the username of Account A, type the repository name and click "I understand, transfer this repository". More info on this is in the GitHub Docs. Repeat this for all your repositories.
Your commit history is registered to the email used in the commit, so this can easily be moved from Account B to Account A. To get this transferred you need to remove the email(s) from Account B, add it to Account A and verify it (the tricky part is if you do not have access to this email anymore).
Have more than one email on Account B? Go ahead and copy the email address from Account B and click the delete button. Then go to Account A and add it back there, then verify it with the email in the inbox of that email address.
If you are deleting Account B; you could just add the primary email back to Account A once Account B has been deleted.
If you are keeping Account B, but want the history on Account A; Add a new email (that is not used on any other account) to Account B and add it as primary. Then remove the last one you want to be transferred to Account A. Then go to Account A and add it back there, then verify it with the email in the inbox of that email address.
With this done you should have all your repositories and all your commit history on one account.
GitHub should enable users to merge or even better add the option to easily transfer the user's settings and repositories from one account to another.
Any questions? Shoot me a message on any of my socials.