Git modify and configure the user name and mailbox

When git push / push to require the use of the user.name and user.email, remember we must now configure
View user.name/user.email

git config user.name
git config user.email

View all configuration information
git config --list
configuration user.name/user.email

git config user.name "newName"
git config user.email "newEmail"

Plus --global can be globally modified, otherwise only the commencement of this git-repo.
Configuring Global user.name/user.email

git config --global user.name "your user name"
git config --global user.email "your user email"

It should be noted that the command can only be used for initial configuration user.name/email, if you accidentally misconfigured, or repeatedly, not by repeatedly performing the above command to modify user.name/email, or it may say or error unable to duplicate the configuration, or cause a key configured with multiple value.
Modify user.name/user.email
If you want to modify the configuration already had user.name or email, there are two ways, one is to be modified by the git bash; one is to directly modify .gitconfig file.
1. git bash

git config --global --replace-all user.name "your user name"
git config --global --replace-all user.email"your user email"

2. Modify .gitconfig file
the file is a hidden file, located in the C: \ Users \ {user} \ gitconfig, directly modify the name or the inside of the email, if there are duplicate name or email, it can be deleted, leaving only. a fine.
You modify, input via git bash git config -list can check whether to amend successful.
Modify the last commit of user.name/user.email

git commit --amend --author="userName <userEmail>"

Note that not the lack of <>
This instruction can only update a recent commit username mailbox

Guess you like

Origin www.cnblogs.com/sunshinekevin/p/11617547.html