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]
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
The pink square wraps the .git
directory, which in VS Code is hidden.
{
"files.exclude": {
"**/.git": false,
}
}
The snippet above shows how to be able to see the .git/
directory if your using VS Code.
Next look at the pink circle, the email is correct now, but the email in that spot was the wrong email.
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.
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
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, andpush -force
the full history. – Outman