Git uses your user name to associate commits with an identity.

The git config command can be used to change your Git configuration, including your user name. It takes two arguments:

  • The setting you want to change--in this case,
  • Your new name, for example, Billy Everyteen

For example:

git config "Billy Everyteen"
# Set a new name
git config
# Verify the setting
# Billy Everyteen

You can also provide a special --global flag, which makes your user name the same across every local Git repository on your computer. For example:

git config --global "Billy Everyteen"
# Sets your name across every local Git repository

Tip: You don't have to use your real name--any name works. Git actually associates commits by email address; the user name is only used for identification. If you use your email address associated with a GitHub account, we'll use your GitHub user name, instead of this name.


My name doesn't show up on GitHub

If the email used in a commit matches a verified GitHub user account, the account's user name is used, instead of the user name set by Git.

New commits aren't using the right name

If git config reports the correct user name for the repository you're viewing, but your commits are using the wrong name, your environment variables may be overriding your user name.

Make sure you have not set the GIT_COMMITTER_NAME or GIT_AUTHOR_NAME variables. You can check their values with the following command:

# prints the value of GIT_COMMITTER_NAME
# prints the value of GIT_AUTHOR_NAME

If you notice a different value, you can change it like so:

GIT_AUTHOR_NAME=Billy Everyteen

My old commits still have my old user name

Changing your user name in Git only affects commits that you make after your change.

To rewrite your old commits, you can use git filter-branch to change the repository history to use your new user name.

Warning: If you're collaborating on a repository with others, it's considered bad practice to rewrite published history. You should only do this in an emergency.

Further reading