Removing email from GitHub also removed commits
Asked Answered
G

1

6

I have 2 emails associated with my Github account, one primary email, and one secondary. When I remove my secondary email from account, almost half of my commits are gone.

How can I persist my commits when removing my secondary email address?

Grimaud answered 11/4, 2022 at 1:58 Comment(5)
Looks like a permissions issue. Have you been added to some organization by your secondary email, and removing it, lost the access?Hendren
GitHub can't remove your commits without corrupting your git repo (which seems highly unlikely that this occurred). What evidence do you have that the commits are missing? Most likely GitHub just doesn't know those commits are yours any longer since you removed the email address that identifies them from your GitHub account. Do a git log locally and look at the commit ids that used your removed email address. Now go check the commit history on GitHub to confirm those commit ids still exist.Tenderloin
I not in any organization. My contribution graph shows 603 commits, but after I remove the secondary email, it shows about 300 commits in the last year. The commits still exists, but they're not associated with my account.Grimaud
GitHub use the email addresses to do the associating. Keep them and the commits stay associated; remove an email address and the commits are no longer associated. Note that this has nothing to do with Git: it's purely a GitHub thing.Soren
Note that there has been some talk about having fancier ways to do the association, since once a commit exists it can never be changed, but the email address in that commit (e.g., "[email protected]") might refer to Bob for 2012-2021 and then to Alice for 2022-2031. But right now it's one-email-maps-to-one-particular-user.Soren
P
1

Any commits that used your old primary email address will no longer be associated with your account if you no longer have that email address associated with your account.

To revert, you would have to add that email address back and verify it. It doesn’t have to be your primary email address.

To prevent this becoming a problem in the future, especially if you are using an email address that is attached to a school or workplace, you can choose to select our email privacy feature and use a GitHub provided address for all of your commits. This isn’t a functional email address, but a way of associating your commits directly with your GitHub account instead of with a specific email address.

Purgatorial answered 30/10, 2024 at 20:23 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.