``
git 中commit提交代码 时候的用户名和邮箱和push代码的时候的用户不一致导致代码提交失败。报错如下
如果之前有其他退回commit之类的操作,可以通过
git reflog 查看commit 记录 的id
在通过
git reset --hard id 跳转到指定的commit
在通过
git config user.name
git config user.email
查看当前用户
git config --global user.name “”;
git config --global user.email “”;
修改用户名和邮箱
保持和C:\Users\用户名.gitconfig中的用户名和邮箱一致
,便于以后提交代码,从根本上解决问题
最后通过
git commit --amend --reset-author
重置当前commit的用户名和邮箱
# 后输入本次commit注释
ESC : WQ 退出
git pull
git push 推送代码即可
如果还是 不理解,可以参考此博主的文章,链接如下http://www.manongjc.com/detail/16-hmedvswauemdxmu.html