Git Author Unknown
My Author Name in All My Commits Is Coming up as Unknown Did This $ Git Config --Global User. Name "Firstname Lastname"Sets the Name of the User for All Git...
my author name in all my commits is coming up as unknown
did this
$ git config --global user.name "Firstname Lastname"Sets the name of the user for all git instances on the system
$ git config --global user.email ""
but still the author/committer name shows [unknown]
not knowing what I was doing I experimented with setting $ GIT_AUTHOR_NAME="my name" and it changed my name to my username [freeenergy] (I.E. my issue was fixed.) But when I switched back to my other computer the issue was the same.
my config file now looks like this but is still committing as [unknown]
[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
hideDotFiles = dotGitOnly
[remote "origin"]
url = :freeenergy/my-project.git
fetch = +refs/heads/*:refs/remotes/origin/*
[user]
name = my name
email = myEmail.com
7 Answers
Even better than running git config, you can edit your ~/.gitconfig file directly. Look and see if there's a section for [user] with the relevant information. For example, my ~/.gitconfig has this...
[user]
name = Bob Gilmore
email =
(There's no space in front of the [user], and single tabs in front of the name and email labels)
If it doesn't have those set properly, just go ahead and edit the .gitconfig file by hand.
I was having the issue of Github not properly linking my commits to my account. If you believe your email is correct, you should ensure that email is also in the Github settings for your account, as per this help page. The last section of caching is also good to note.
Copied in case of a catastrophic event in which Github goes down or ceases to exist.
Why are my commits linked to the wrong user?
GitHub uses the email saved in a commit's header to link the commit to a GitHub user. If you find your commits are being blamed on another user, or not linked to a user at all, you should check your settings.
Good to know: commit blame does not grant access to a repo. If you are seeing commits blamed on a user you do not know, don't worry. The user does not have access to your repo unless you've explicitly added them as a collaborator on that repo or to a team that has access to the repo.