Added Collaborator with commits not showing as Contributor

TL;DR

A person’s commits made can be seen with their GitHub ID in the commit history and the person is also added as a collaborator. Yet the person is not showing as a Contributor.

I have a GitHub repository created by me, which was private until now. To allow my friend to commit to it, I had added him as Collaborator (in the “Manage Access” section).

After getting access to the then private repository he committed several times. But, his name never got into the contributors. It felt maybe, of the repository being private.

But now when the repository is turned public, his name is yet not included in the contributors.

Note: Both of us are relatively new to GitHub.

I’ve had a look - I can see that there is one contributor on one of your repositories who may have their email address stored with a typo in their git config settings. This would lead to their commits not appearing to come from their account, and therefore not listed as a contributor.

Your friend can check quickly by using this command:

 git config --global user.email

If it is wrong, this guide may help:

1 Like

Thanks, indeed this was the issue.

But, I wonder when someone is providing their GitHub credentials accurately why do GitHub specifically need the email address.

Isn’t the GitHub credentials meant to act as an alternative to an email address for GitHub related tasks?

This is a general Git thing, not only for Github. Git records author information in the commit itself. For a bit more detail on that, see:

It is possible (common, even) that people push commits they didn’t author, e.g. after merging code someone else contributed. Github cannot just ascribe commits to whoever pushes them, so they use the author information in the commits, which is meant for exactly that purpose.

If you (or your friend) want to keep your email address private, Github lets you use a special (not working for mail) address connected to your account. See the documentation About commit email addresses for how to do that.

2 Likes

I found out that private emails are not shown in contributors (at least that happens with my account), so better to hold email public