使用git推送到分支的时候,会有这样报错:
gerri push git remote: ERROR: committer email address remote: ERROR: does not match your user accoun

原因是:
本地配置的用户名邮箱配置错误。(可能是之前拉取过别的仓库的代码)


修改配置方法:
配置用户名
$ git config --global user.name "loushengyue"
查看已配置的用户名
$ git config --global user.name
配置邮箱
$ git config --global user.email loushengyue@xx.com
查看已配置的邮箱
$ git config --global user.email
切记!!此时你已经commit到本地,所以你修改完再推送还是按照之前的配置来,还会报错,所以此时你需要将之前的commit进行reset一下
使用命令:
git reset --soft HEAD^
HEAD^的意思是上一个版本
如果你进行了2次commit,想都撤回,可以使用HEAD~2

此时再同步代码,重新commit,重新push,大功告成!
当使用git推送至分支时,如果遇到committeremaildoesnotmatchyouruseraccount的错误,通常是由于本地配置的用户名或邮箱不正确。解决方法包括检查并修改git的全局用户配置,如`gitconfig--globaluser.name`和`gitconfig--globaluser.email`。若已提交更改,则需用`gitreset--softHEAD^`撤销最近的commit,然后再提交和推送,以应用新的配置信息。

5626

被折叠的 条评论
为什么被折叠?



