Commits showing a different user

I normally use my work github account on windows, but i logged out of the github in vscode, and then i created a new repo in with my personal account. after that i initialised a local repo, added the remote to my personal repo, and then created the local git config as per my personal repo. while pushing git asked me to login , i generated a PAT in my personal account and pasted the code to login. and then i pushed the code.
also this is a private repo. but when i pushed the code, in github it is still showing my work account in the commit.
How can i resolve this situation.

Which account GitHub ascribes a commit to depends on the author email address recorded in the commit. How you authenticate the push or who pushes the commit doesn’t matter.

To set the correct author email for future commits see Setting your commit email address in Git, and not that you can do this both globally and per-repository (which overrides the global setting).

If it’s just the latest commit, you can use git commit --amend --reset-author to reset the author address after you have fixed the settings. If there are more, you’ll have to look at git rebase or maybe git filter-branch, see Git - Rewriting History.

I have already set my user email in local config using
git config
but still the commit is using the wrong email

I have found out the cause of this issue. when i am using git bash as terminal in vscode the commit is done using my work email, but I tried using command prompt as terminal in vscode, and it is using the correct email as per the config file. I think it is using the global config for some reason.

1 Like

This is pecuilar! I don’t use VSC or Windows so I can’t say how to fix that. Maybe someone else here can?

1 Like

Proc Mon from

Can hello you figure out what’s going on.

It’s possible/likely that they’re checking different home directories for different config files.