Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Incorrect Git user name and email on Windows

Tags:

git

windows

I use Git on Windows and set the username and email with:

git config --global user.name "hydRAnger"
git config --global user.email "[email protected]"

When I use:

git config --global --list

I get the output:

user.name=hydRAnger
[email protected]

However, when I use git log the author info should be:

Author: hydRAnger <[email protected]>

But in fact I get the output:

Author: unknown <hydRAnger@hydRAnger-PC.(none)>

I don't know why the author information incorect.

like image 775
hydRAnger Avatar asked Jan 29 '12 14:01

hydRAnger


People also ask

How do I change my username on GitHub Windows?

a) Running git config --global --list OR b) Opening ~/. gitconfig in an editor. To update your global user name (applies for future commits in ALL local repositories) run, git config --global user.name <username> .

Why are my commits linked to the wrong user?

GitHub uses the email address in the commit header to link the commit to a GitHub user. If your commits are being linked to another user, or not linked to a user at all, you may need to change your local Git configuration settings, add an email address to your account email settings, or do both.


2 Answers

Setting the user.name and user.email config options does not change already existing commits. It will only work for future commits.

If you also want to rewrite existing commits to use the new user data check out this question:

Change the author and committer name and e-mail of multiple commits in Git

like image 78
Koraktor Avatar answered Nov 01 '22 02:11

Koraktor


Did you reset the author on your commit after updating your details?

git commit --amend --reset-author

(This will bring up the commit message again - you can just leave it intact)

like image 27
James McLaughlin Avatar answered Nov 01 '22 01:11

James McLaughlin