18

Have got a git repo with incorrect contributors and their contributions. Repo has few commit's from different emails and alias name and we have added .mailmap to resolve this issue.

Shortlog recognizes .mailmap and groups contributions accordingly, but it doesn't reflect on GitHub. Does GitHub consider .mailmap file or should we have to wait for GitHub re-run the graph.

git shortlog -sne

Note: We have waited for 24 hours already

5
  • Yes, github consider .mailmap file Commented Dec 5, 2018 at 9:38
  • @Andreas yes git considers, and shortlog is the proof. Need to know about github considers as well ? The link points git repo that is hosted on github, so i am considering it as git documentation and not github's. Commented Dec 5, 2018 at 9:40
  • 1
    Did it ever start working for you? I'm curious if it works as well. I can find no evidence that it actually works. Commented Jan 9, 2020 at 17:42
  • @donatJ Yes, it worked for us. Commented Apr 4, 2020 at 3:56
  • 2
    @Andreas as of today the link is broken and documentation does not contain any mentioning of mailmap support any longer ( Commented Oct 29, 2024 at 9:32

3 Answers 3

10

GitHub currently (as of 2023-12-06) does not remap author names or email addresses according to the rules in a .mailmap file.

I've created a small test repository that you can use to verify this.

Sign up to request clarification or add additional context in comments.

3 Comments

The only difference I can see in your test repo is the syntax you used. IIRC your syntax is fine, but maybe it's not what GitHub supports (we don't know how they process the file), you can look up here (github.com/apache/calcite/blob/main/.mailmap#L21-L24) what worked for me. My wild guess is: if you put one line with an email address linked to a GitHub account (primary or secondary) and another wrong email account in another line, it will be linked to your GitHub account. Not sure for the user name though. It's empiric testing as the feature seems undocumented in GitHub as of now.
The 4 lines in your mailmap file just say "The full name for these 4 email addresses should be Alessandro Solimando". This does not mean that these 4 committers are the same person. Name collisions happen. Github publicly documents that commits are attributed to users by email address match. Your mailmap entries do not remap email addresses. Your combination of author and committer is associated with your profile without any mailmap files.
What can be tried is to update your test repository with, in the mailmap, your own email address(es) linked to GH and one wrong/unrelated address with the same exact name, one with another name, and see what happens at that point. Your example is different as there is no "anchor" for GH to do the mapping I think, so it does not reflect what happened to me.
4

Github considers .mailmap file for contributions and it takes time to update contributors graph and pulse (in our case it was 24 - 36 hours )

8 Comments

I have not been able to get this working, despite waiting several days. Are you willing to post a link to the repository where you got .mailmap to be reflected in the Contributors graph?
It was in a enterprise github installation with restricted access.
@MusicMan this Github Community post from July 2020 says that "GitHub does not support using mailmap files" and "The only way to update the contributor details in your commits is to rewrite git history". I just pushed up a .mailmap file to my Github Enterprise Server repo and will update here if my contribution graph is corrected.
Hmm, strange. It's been 4 days since pushing up the .mailmap and our Github Enterprise Server repo is still not showing a fixed contribution graph.
Doesn't work for me either. The only thing that works for me is adding the email addresses of the commits that aren't recognized under Settings/Emails.
Hmm does the email has to be verified? I'm transfering old repo on GitHub where I mistakenly used work emails which I don't have access to anymore. Maybe it just takes time to re-compute, but adding the email being unverified, seems to do nothing. Thanks
|
-2

GitHub currently (as of 2025-01-13) does support .mailmap files (here is the commit amending the .mailmap file), tested on Apache Calcite upstream repository after mistakenly committing with an invalid email address (here is the commit with the invalid email address).

After approximately 24 hours it has picked up the change and updated the commit count, so it works now.

This is how the commits are displayed in git log, notice the erroneous [email protected] in the bottom commit, which can't be added in my GitHub account because that address does not exist (it's "apache.org").

commit 60953ecd9c055e0e029de0d6034037cc7d68361a Author: Alessandro Solimando [email protected] Date: Sun Jan 12 21:31:23 2025 +0100

Add Alessandro Solimando to .mailmap file

commit 27d733e1753b8be7145ac7645d77e5c4901a29fc Author: Alessandro Solimando [email protected] Date: Sun Jan 12 19:46:54 2025 +0100

[CALCITE-6782] Upgrade Cassandra to 4.1.6 and Cassandra driver to 4.18.1

If you look in GitHub, you can see that 3 is now correctly linked to my GitHub account (see also the commit count), and it can't be anything else than the .mailmap kicking in as it's not and could not be linked to my account as it's a non-existing email address (you can try to send an email there and see that it can't be delivered).

9 Comments

Probably as of 2025-01-13?
Can you link the commit with the wrong email address? The mailmap file is still ignored in the test repo I linked above.
If you are referencing your older commits where you used a gmail address: GitHub is mapping that email address to your account because you have verified it with your account. This has nothing to do with the mailmap file. I added a commit with the gmail address here, it is also attributed to you, without any entries in the mailmap file. I'm not convinced this answer has any substance to it, but I'd love to be proven wrong.
@RichardE, I have added more details to the explanation. I am referring to a commit with "[email protected]" (the right one is "[email protected]"), my gmail address is my primary email address in my GitHub profile, and it works for "[email protected]" too if you try, but try with "[email protected]" and it won't work, as it didn't for me until I fixed .mailmap in Calcite. I hope that's enough substance to turn your -1 into a +1...
Thanks for the commit link. Take a look at it with git show --format=fuller 27d733e1. Note that git tracks both the "committer" and the "author". The commit has the ".com" email set as the author, but your github-associated gmail address set as the committer. GitHub uses that to attribute that commit to your account. I've created a demo commit that uses the same author/committer combo, and it's associated to you without any mailmap entries.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.