Change Avatar Next to GitHub Username (For Commits)
Asked Answered
M

3

18

I have a username on GitHub and have an avatar for that -- easy enough.
The Get a single user V3 API does include my gravatar when I call it with my GitHub id.

However, when I push my commits, I have my name show as the committer but next to it is that goofball octocat silhouette. How can I change this?

Metatherian answered 19/4, 2012 at 3:31 Comment(2)
I see your gravatar since commit e82f7d0e6c now: you have updated your config file. If your repo (I won't mention because you didn't leave any information in your public SO profile) isn't shared/cloned yet (at least, it isn't forked) by others, you could consider rewrite the author for all the commits, and push -force the full history.Outman
I took the liberty to change slightly the phrasing of your question, in order to facilitate its integration in this (programming Q&A) site.Outman
O
25

Check your author and email information associated with your commits as published inn your GitHub repo.
If they aren't exactly identical to those of your GitHub profile, then your gravatar won't be displayed for those commits.

Outman answered 19/4, 2012 at 4:19 Comment(2)
Thanks. Got a gravatar for the email I'm using and all is well.Metatherian
You can have multiple emails in your github account, but make sure that your local git email matches the one which has your gravatar (help.github.com/articles/setting-your-email-in-git)Irkutsk
J
9

FYI: GitHub uses your G rated gravatar, so be sure to set that (and not your PG and above).

Jordonjorey answered 3/8, 2012 at 0:19 Comment(0)
K
2

So I had a Problem with my Avatar as Well

This answer is the working solution, at least in 2022.

Meta Commentary:

This answer uses photos I took of my own screen while using VS Code, but the file hierarchy for git should be the same regardless of the environment.

The issue I had, was that I am white, 36, beardless, long hair, and basically I am what you would expect a guy to look like from California (except I have brown hair not blonde). My avatar was showing an image of an older man who looked Indian (he was from Bangladesh), he was balding had a long beard and obviously darker skin than mine. It was a completely inaccurate representation of myself, and I didn't want other people to think I was someone who I am not.

I tried to fix it using the commands:
~$ git config user.name jD3V
~$ git config user.email [email protected]
~$ git config --global user.name jD3V
~$ git config --global user.email [email protected]


  1. Then of course I used...
~$ git config --get user.name jD3V
~$ git config --get user.email [email protected]
~$ git config --global --get user.name
~$ git config --global --get user.email [email protected]

The configuration values returned by the commands were what I expected them to be, but nothing changed. A few weeks went by, and I got tired of looking at that guys picture. It actually started making me mad.

I started trying anything I could think of: Restarting my computer, reinstalling Git, I reconfigured my entire GitHub account (which took 3 hours), I crawled through my .git directory. Nothing, it still was the same, and only for this one project/repository.

I tried cloning the project to a different directory, and...

SUCCESS! a photo of me popped up, Yay!!!

Unfortunately the happiness was brief. I wouldn't be content, until I knew why that happened.


Turns out, the problem was this


I included an image to help explain. Okay look at the image, there is a pink square & a pink circle. We are going to look at the square rn.

(I'll continue below the image, so you can look at it...)

The encrypted keys have been altered for security reasons

enter image description here

The pink square wraps the .git directory, which in VS Code is hidden.

  {
    "files.exclude": {
      "**/.git": false,
    }
  }
  1. The snippet above shows how to be able to see the .git/ directory if your using VS Code.

  2. Next look at the pink circle, the email is correct now, but the email in that spot was the wrong email.

  3. If you look at the yellow circles, they are circling a wrapped line (in other words they wrap the same thing, it is just broken up because the line was to long for the view). That shows that the first line in this file is logging the initial commit for the project.

  4. If you look at the pink arrows, specifically the 2nd pink arrow, you will see that it is the "./.git/logs/HEAD" file that we are looking at. When the avatar is grabbed, the first line of this file is used to find the account for the avatar

Anyways, hope this helps someone

At this point, I restarted VS Code a couple times, then restarted my computer.

Everything Looked fine, worked fine, but I still had the same Avatar
Kob answered 23/5, 2022 at 23:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.