-2

I have 2 GitHub accounts, let us call them g1 and g2.

I am mostly actively developing on g2 now. However, I realized today that even though I am committing and pushing to the correct repo in g2, the g2's repos somehow show that g1 is a contributor and most commits are made by g1.

I checked git config --list --show-origin and my git config's user.email is set to my old g1's email and I suspect that is the cause. I hope someone can enlighten me on this.

What is the correct way to rectify this? It certainly seems odd to have most commits made by my old account ... though thankfully the "name" of g1 is also my real name.

ilovewt
  • 674
  • 6
  • 16
  • 2
    With git, who is pushing doesn't matter. It's who is configured as the commit author that matters. – evolutionxbox May 11 '22 at 13:23
  • I see now, overlooked the importance of setting the `git config`, an oversight when working on the same computer... – ilovewt May 11 '22 at 13:30
  • 2
    You can clone your repo's for g1 under one folder and the repo's for g2 under another. Then put a `.gitconfig` file g1's folder with the correct user+email and another config in g2's folder. That way all repos will pick up the value in the parent folder's config file. – jessehouwing May 11 '22 at 13:34
  • From my point of view what you are asking was answered before, please refer to https://stackoverflow.com/questions/4981126/how-to-amend-several-commits-in-git-to-change-author/69947947#69947947 Don't use git rebase is inefficient and a bad practice to solve this problem – Adel Balbisi May 11 '22 at 15:58

0 Answers0