How do I change my author name on GitHub?
$ git config --global user.name "Scott Chacon"
$ git config --global user.email "[email protected]"
Add something like this to a file called ~/.gitconfig
(in your home directory):
[user] name = USERNAME email = EMAIL_ADDRESS
where USERNAME
and EMAIL_ADDRESS
are filled in appropriately
Note that starting Git 2.2 (Q3/Q4 2014), and commit 9830534 by Matthieu Moy (moy
), you will be naturally guided to enter a user and email:
config --global --edit
: create a template file if needed
When the user has no
~/.gitconfig
file,git config --global --edit
used to launch an editor on an nonexistant file name.Instead, create a file with a default content before launching the editor.
The template contains only commented-out entries, to save a few keystrokes for the user. If the values are guessed properly, the user will only have to uncomment the entries.Advanced users teaching newbies can create a minimalistic configuration faster for newbies.
Beginners reading a tutorial advising to run "git config --global --edit
" as a first step will be slightly more guided for their first contact with Git.
If you put your GitHub username and email account in those settings, your commits will accurately reflect your GitHub account as the right author.
Note that the user.name and email are guessed and put in that /.gitconfig file, as per commit 8b27ff7:
commit: advertise config --global --edit
on guessed identity
When the user has no user-wide configuration file, it's faster to use the newly introduced config file template than to run two commands to set
user.name
anduser.email
. Advise this to the user.The old advice is kept if the user already has a configuration file since the template feature would not trigger in this case.
New advice:
Your name and email address were configured automatically based on your username and hostname.
Please check that they are accurate.
You can suppress this message by setting them explicitly. Run the following command and follow the instructions in your editor to edit your configuration file:"
git config --global --edit
After doing this, you may fix the identity used for this commit with:
git commit --amend --reset-author