33

I just helped a friend to set up a Github account to collaborate on my project. His commits come through, but for some reason on the "Source" page of my repository next to his commit is only his name and not his username (with a link).

It seems strange, since Github obviously recognizes him (I added him to the list of collaborators etc.

Seems like a stupid question, but Google couldn't help.

Thanks!

Alexei Boronine
  • 11,061
  • 4
  • 19
  • 14

5 Answers5

28

Does your friend have the e-mail address he is using for his commits correctly set up as an alias in GitHub? Otherwise, how is GitHub to know who he is? Git itself only records the full name and the e-mail address and obviously not the GitHub username, since you can use Git perfectly fine without GitHub.

Geerten
  • 1,027
  • 1
  • 9
  • 22
Jörg W Mittag
  • 363,080
  • 75
  • 446
  • 653
  • 112
    Thank you for the answer. But it seems to me that using that logic (StackOverflow is not the [whatever] support forum), 99% of StackOverflow would be gone. – Alexei Boronine Nov 17 '09 at 04:37
  • 11
    For people like me wondering why the comment has more upvotes than the answer - The answer originally contained this line - "Please note that StackOverflow is not the GitHub support forum. There are better places for questions like this, like, say, the GitHub support forum." – paradocslover May 03 '21 at 03:01
9

Add the email used in the git commits to github via Account Settings: Email Settings

Vincent Scheib
  • 17,142
  • 9
  • 61
  • 77
9

Run this in Terminal:

  git config --global user.name "your-github-username"
  git config --global user.email "your-github-email"
Shaun
  • 311
  • 2
  • 7
  • 16
    Please ignore this. You should never change your Git settings just because of where you happen to host your repository today. What happens if you decide tomorrow to host your repository on Gitorious or Assembla or Repo.Or.Cz or Codaset? Or you want to host it on multiple websites, for safety and redundancy? Instead of changing your Git settings to play nice with GitHub, you should change your GitHub settings to play nice with your Git settings. – Jörg W Mittag Nov 17 '09 at 04:31
  • Is the username/email attached to your commits going to be dramatically different if you're using different hosting providers? – mipadi Nov 17 '09 at 13:44
  • The username and e-mail address attached to a Git commit is exactly what you tell Git to. – Jörg W Mittag Nov 17 '09 at 19:00
  • 7
    Right, I'm just suggesting that there's nothing wrong with putting your name and email address in your global Git config, if that's what you typically use to "sign" your commits. – mipadi Nov 18 '09 at 19:00
  • 3
    You should do the above, but you shouldn't do the `--global` flag. That way it's repo specific. – Mauvis Ledford Sep 26 '12 at 23:35
  • Additionally, you can add more than one email to your github username under settings. Not sure if it retroactively updates old commits but your new ones definitely get associated to your github username. – Mauvis Ledford Sep 26 '12 at 23:55
  • user.name is the username? If yes, why do people type their names? Even the documentation says the same. – Ankur Sinha Feb 09 '13 at 07:23
0

Just ask your friend to add email that he use in local git commits to his GitHub account emails list as stated in GitHub Help

Sevenate
  • 6,221
  • 3
  • 49
  • 75
-1

you can check the GitHub article:

$ git config --global user.name "example"

$ git config --global user.email "email@example.com"