0

I have two Github accounts: marquizzo(personal) and tb-marco(work).

I create repos under marquizzo, but whenever I make a commit, they always say it's tb-marco who made the commit. See screenshot below:


enter image description here

How do I make it so marquizzo is the author from here on out? As recommended in this article, I've performed $ git config --global user.name "marquizzo". I've done both in global and inside the repo's folder, and still nothing changes.

I should mention that the only account that has SSH keys enabled is marquizzo, and I have those keys stored in the computer that I'm using, so that should be the author, correct? How can tb-marco be the author if the repo is private? Where is this setting stored, and how can I change it?


enter image description here

M -
  • 26,908
  • 11
  • 49
  • 81
  • 2
    GitHub use the email address stored in the commit (which is just a text string that you can set at the time you *make* the commit: nothing in Git itself checks this!) to associate the commit with a GitHub user. This mapping, from email address to GitHub User Name, is a thing you set *on* GitHub. So there are two things to do: control the email address in the commits, and control the mapping on GItHub. – torek Feb 04 '22 at 06:43

1 Answers1

1

User @Torek had the answer. Instead of changing the username in the git configuration, I had to change the e-mail address. I found the instructions on how to do this in the first-time Git setup documentation

$ git config --global user.name "John Doe"
$ git config --global user.email johndoe@example.com
M -
  • 26,908
  • 11
  • 49
  • 81
  • 1
    Seems inconvenient to store this config in global gitconfig file? Maybe would be more optimal to store it in the local gitconfig file, so that in your private repo you have `user.email=johndoe@gmail.com` and in your work repo you have local config `user.email=johndoe@work.com`. Otherwise you will have to keep switching email config, and you will probably occasionally forget to switch. – Alderath Feb 04 '22 at 11:52