MikeTheTall
MikeTheTall

Reputation: 3553

Credentials for GitHub 'stuck' on my other account

I've been trying to push commits to GitHub using my 'real' account (MikeTheGreat) but no matter what I do GitHub keeps listing them as my other account (StudentDemoAccount). I've been able to clear my credentials (as evidenced by the fact that when I try to do a git push it asks me for my username and password again), but when I type in my MikeTheGreat account info the commit is listed on GitHub as being from the StudentDemoAccount.

I've gone through a bunch of pages, including:

I'm able to force Git to re-authenticate me (by re-generating the GitHub Personal Access Token), but whenever I give it my MikeTheGreat credentials it still lists the commit as coming from the StudentDemoAccount.

I'm on Windows 10, and am using the command-line git tools on a CMD.exe.

Upvotes: 1

Views: 335

Answers (1)

MikeTheTall
MikeTheTall

Reputation: 3553

It looks like GitHub uses the user.email git config key to determine which account the commit should be tied to. Changing that fixed the problem:

git config --replace-all user.email <email address for MikeTheGreat>

It's worth pointing out that this answer specifically says that

The data used by git config (and in your config) file is used for creating the author of the commit. You can put in anything in there - it doesn't matter, there's no verification that this is actually you or any other valid address.

I think they're talking about specifically about user.name, but it was late and I read it as 'anything about the user that I set via user.*'.

Upvotes: 1

Related Questions