Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to merge two GitHub accounts

Tags:

git

github

I have two GitHub accounts, one of this was created a long time ago at my work and has an username that refers to the company where I work.

I have another account which is my personal GitHub account that I can't stop using.

Could I merge the two accounts so I can work in only one of these?

like image 859
Rodrigo Curbelo Avatar asked Jun 08 '16 04:06

Rodrigo Curbelo


People also ask

Can I merge my 2 GitHub accounts?

If you have separate accounts for work and personal use, you can merge the accounts. Tip: We recommend using only one personal account to manage both personal and professional repositories. Warning: Organization and repository access permissions aren't transferable between accounts.

Can you have two GitHub accounts one computer?

Go to Settings . From the left side navigation, click SSH and GPG keys . Click on New SSH key , name it (it's a good idea to name it after the computer you're using it in), and paste the key you previously copied. Click Add key .


3 Answers

Merging 2 accounts is not possible at github, you can transfer ownership to your personal account.

goto  >> Setting >>Transfer ownership  

For more details : https://help.github.com/articles/merging-multiple-user-accounts/

like image 148
Mohammad Fareed Avatar answered Oct 03 '22 09:10

Mohammad Fareed


Responding with updated answer here (relevant in 2019).

Luckily this is a relatively quick process to 1) transfer repo ownership, 2) manage (add/remove/change) account email addresses, and 3) keep/transfer most commit history to the profile’s contribution graph.

Transferring repository ownership only requires a few steps.

  • From Repo > Settings page > Options > scroll to the bottom, looking for red-colored “Transfer” button within the “Danger Zone”
  • Fill out the required fields, typing the name of the repository to confirm and entering the new owner’s GH username
  • 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

Repo transfers between accounts includes all issues, pull requests, forks, stars, alongside automatic redirects being setup for git and http. Though you should update your remote’s origin URL once the transfer is complete: git remote set-url origin new_url

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. Keeping/transferring commit history to contribution graph comes when you add original, authoring email/verify it on user account you're consolidating/merging into.

  • From GH dashboard > Click your profile photo dropdown > Settings page
  • Click on Emails in the left sidebar > Add email address field > Add new email
  • 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

Previous note about most history transferring is referring to PRs and issues which fall under this "grey area" of history and will not transfer when combining accounts.

After you've added email to GH user account + verified it, most commit history will transfer. Allow GitHub a bit of time to propagate the history and contributions between accounts.

You will lose commits tied to original pull requests and issues histories tied to account you're removing. These “...would instead be attributed to our “Ghost” user once the account is deleted, though the issues/PRs themselves would otherwise be unaffected.” (from GH Support). If you're looking to read more, I wrote up a quick blog article for this with steps and visuals on transferring repo ownership, adding emails, and more - how to merge/combine two (or many) GitHub user accounts.

GitHub does recommend using one user account for personal and professional (work) repositories (source), definitely consider doing so!

Managing multiple user accounts can be cumbersome, though there are ways to simplify workflow of multiple accounts, though, so in the case this response wasn't for you and you want to keep your many accounts as-is, see how to manage multiple GH accounts on one machine with SSH keys.

like image 33
Scott Mathson Avatar answered Oct 03 '22 09:10

Scott Mathson


While Github outlines a limited "Merging multiple user accounts" process, which is also mentioned in previous answers, it is not a complete solution. It does not resolve ownership in third party repositories contributions.

GitHub will display comments from a deleted user (which will be the account you got rid of following GitHub's account merge suggestion) as "ghost" user's comments - without attributing them to the surviving account. See some more details here:

https://help.github.com/articles/deleting-your-user-account/

So in reality as of November 2016 there is no general way to fully merge all contributions from one account to another.

like image 41
Vlad Didenko Avatar answered Oct 03 '22 10:10

Vlad Didenko