0

Have a look at the contributors page for this project:

https://github.com/Sahand1993/CraigslistPrice/graphs/contributors?from=2018-04-22&to=2018-05-14&type=a

My username is Sahand1993. If you look at my graph, it says I've only added 2 lines of code. But if you look at the project file called elasticsearch/searcher.py, you'll see that I added that entire file, which is around 200 lines long!

So, why is Github saying I've only added 2 lines?

Sahand
  • 7,980
  • 23
  • 69
  • 137

1 Answers1

2

GitHub matches commits to users via the email address in the commit. You haven't set your email address properly.

I see several commits from sahandzarrinkoub@n157-p198.eduroam.kth.se and sahandzarrinkoub@Sahands-MBP.lan, but only one from sahandz@hotmail.com. This last email address is the one you've registered with GitHub.

If the other email addresses are real email addresses that you own you can add them to your GitHub account and claim those commits. But I don't think they are (certainly the one @Sahands-MBP.lan doesn't look right).

I suggest

  1. Adding any email addresses you plan on using to your GitHub profile.

  2. Setting your email address properly on those two machines, e.g. via

    git config --global user.email "sahandz@hotmail.com"
    

    This will enable GitHub to associate new commits with your account.

  3. Adding a .mailmap file to map the wrong email addresses to the correct email address.

ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257
  • Thanks, Chris. Is there any way to get credit for the commits that were made with the faulty email addresses? Is that what your option 3 is for? – Sahand May 14 '18 at 13:09
  • 1
    @Sahand, I've seen people say that 3 works on GitHub. I've also seen them say it doesn't. The surefire way would be to [rewrite those commits](https://stackoverflow.com/q/750172/354577) and push to GitHub using `--force-with-lease`. In my opinion that's a big hammer for a tiny nail (I'd just leave the commits as-is and accept that the author information is wrong), but you may disagree. Please bear in mind that [rewriting history has major implications](https://stackoverflow.com/q/1491001/354577), especially if you're working with others. Please do your research if you go down that path. – ChrisGPT was on strike May 14 '18 at 13:15
  • Right, probably too big a job for the reward. Lesson learned. I'll try your 1,2,3 :) – Sahand May 14 '18 at 13:25
  • One more question, how did you find those email addresses? I've looked around the github website and I can't find them myself. – Sahand May 16 '18 at 19:38
  • 1
    On GitHub, if an email address matches an account, the committer's name will be linked to their account, e.g. here: https://github.com/Sahand1993/CraigslistPrice/commits/master. I noticed that most of your commits weren't linked, which is what led me to the email mismatch. I cloned the repository and the used `git log` to look at the commit data locally. – ChrisGPT was on strike May 16 '18 at 21:18