批改本仓库的用户名和邮箱

git config user.name 'new username'
git config user.email 'new email'

批改全局用户名和邮箱

git config --global user.name 'new username'
git config --global user.email 'new email'

批改已提交内容的用户名和邮箱

1.关上终端

2.复制粘贴脚本,并依据你的信息批改以下变量

OLD_EMAIL
CORRECT_NAME
CORRECT_EMAIL

#!/bin/shgit filter-branch -f --env-filter 'OLD_EMAIL="your-old-email@qq.com"CORRECT_NAME="newName"CORRECT_EMAIL="new-emil@qq.com"if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]thenexport GIT_COMMITTER_NAME="$CORRECT_NAME"export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"fiif [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ]thenexport GIT_AUTHOR_NAME="$CORRECT_NAME"export GIT_AUTHOR_EMAIL="$CORRECT_EMAIL"fi' --tag-name-filter cat -- --branches --tags

git log 查看历史记录批改状况

3.应用git push --force --tag origin 'refs/heads/\*' 把正确的历史提交记录提交的到github服务器