7

How can I use a fake email address with Github?

Following Github's since-changed instructions, I had a fake email like user@server.fake configured with git (git config --global user.email "user@server.fake") and registered on my email settings page.

It was linking my commits, but not since the past week or so, and it has a "(?)" tooltip saying:

This email will not be used for commit blame

My real email address is verified and blamable, but I want to keep it private.

How can I use a fake one and still be blamed?

Hugo
  • 27,885
  • 8
  • 82
  • 98

1 Answers1

7

Github has seen many collisions with generic and fake email addresses and have changed how they are registered.

Do two things and an optional third.

1. On the email settings page check the box:

Keep my email address private.

We will use username@users.noreply.github.com when performing git operations and sending outgoing email on your behalf.

2. The "Keeping your email address private" help page says to use "username@users.noreply.github.com".

Change git config to username@users.noreply.github.com:

git config --global user.email "username@users.noreply.github.com"

3. Optionally rewrite history on your repos to change the author -- but heed the warnings!


This help page says to contact Github to backfill previous contributions, but this only applies to verifiable addresses.

I asked Github support. They said:

As you've noticed, we've made some recent changes to how emails are used for commit blame and counting contributions. We were seeing a large number of collisions with generic and "fake" emails, which were confusing users. Unfortunately that means that commits made with an address like "server.fake" will no longer be linked up to your GitHub account.

The backfilling process only works for email addresses that can be accepted by our system and used for commit blame, so unfortunately that wouldn't help in your situation.

If you want to link up the old commits, it will require rewriting the history to use your username@users.noreply.github.com address. We have a guide on that, though you may want to give it some consideration if there are other users using your repositories, as history rewriting can be a fairly disruptive activity.

Community
  • 1
  • 1
Hugo
  • 27,885
  • 8
  • 82
  • 98
  • I actually tested this out independently. (1) Using "Keep my email address private" will still reveal your email address in the url for the commits appended with `.patch`. (2) I tried using `@users.noreply.github.com`, but this prevents your contributions from being recorded on your profile page. It seems like you need a "real" email address. However, the address doesn't have to be verified by clicking the link that GitHub emails, so perhaps a "real-sounding" email address is good enough. – Sparhawk Sep 08 '14 at 12:18
  • @Sparhawk I'm using `@users.noreply.github.com` and they're linked to my profile. – Hugo Sep 08 '14 at 13:25
  • Hmm… I'm not sure what's going on there. Are these recent commits? I've only noticed them missing from my profile quite recently. – Sparhawk Sep 08 '14 at 14:41
  • @Sparhawk: Yes, they're recent commits. I also have "Keep my email address private" checked at https://github.com/settings/emails . I recommend [contacting GitHub support](https://github.com/contact), they respond quickly. Let me know the result! – Hugo Sep 09 '14 at 07:29
  • I just received a reply that is the same as what you said. `In order to use the private email address for contributions, you need to enable it. You can do that by checking the "Keep my email address private" box`. I actually can't remember if I did that first, or if that matters, but I was pretty sure I did. Anyway, I've used a "real" address now, and I'm not going to try and `git filter` to test again! If others are having problems, as I mentioned above, a "real-sounding" email address might suffice. (+1 for the follow up) – Sparhawk Sep 09 '14 at 10:49
  • But how do I find the "invalid email" that the error tells me about? So If it's an old email address, I can add it to my account. – Iulian Onofrei Feb 11 '15 at 13:06