To change your git username setting, use the
git config command:
git config --global user.name "Billy Everyteen" # Set a new name git config --global user.name # Verify the setting # Billy Everyteen
The command takes two args:
- setting name:
- new name:
--global flag writes this setting into your global git config. If you remove that flag you can override the setting for your current repository.
Tip: You don't have to use your real name, any name will do. If you use an email that matches a GitHub account, we will show that account's username instead of this name.
If the email used in a commit matches an account on GitHub, the account username is used instead of the commit's username. You can still view the commit's username by checking out the commit's patch format.
git config user.name reports the correct value for the repository you're viewing, but new commits are using the wrong name, you may have environment variables set that are overriding the setting. Make sure you have not set the
This setting only affects future commits. To rewrite your old commits:
git filter-branchto rewrite the repository history (see this guide) and
- Force-push the new history up
Warning: It's considered bad practice to rewrite published history; you should only do this in an emergency. Simply use the new name going forward.