I am relatively new to git. I have been using the same computer and own two different GitHub accounts. Let's call it old one and new one. I used old one long time ago and now when I tried to commit changes to the repository of my new account, it shows the commit changes are made by my old one.
I tried to change that by using this command:
git config --global user.email youremail@email.com
Now after visual studio code asked me for my personal access token, whenever I commit, it shows that my new account is making those changes. Also, I can swap between these two accounts by simply using the command above. My questions are:
If you run git log
, you will see an email address associated with each commit. This data is "burned" into the commit. Changing it requires redoing the commits (rewriting history) which results in new commit hashes.
The email address value used for the commit is the value currently set for user.email
in your git config, which by the way you can set globally (git config --global
) or locally per repo (git config --local
).
This is just GitHub trying to link the email addresses on commits to GitHub user profiles so that people can discover other things the author has done.