修改 git 用户名以及提交邮箱

修改 git 用户名以及提交邮箱

问题背景:在已离职的同事电脑提交自己的 github 代码,尽管有重新设置了自己的 SSH ,但是 github 上提交结果却还是离职同事的。

1. 验证当前本地属性

╭─xuxiaobo@xuxiaobodeMacBook-Air ~
╰─$ git config --local --list
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
core.ignorecase=true
core.precomposeunicode=true
remote.origin.url=[email protected]:longjxchina/jhb-dev.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master
branch.master-e2e.remote=origin
branch.master-e2e.merge=refs/heads/master-e2e
(END)

╭─xuxiaobo@xuxiaobodeMacBook-Air ~
╰─$ git config user.name
hejiajie

╭─xuxiaobo@xuxiaobodeMacBook-Air ~
╰─$ git config user.email
670****[email protected]

2. 解决方法

使用命令修改 git 用户和提交的邮箱:

# git config user.name 要修改的用户名
╭─xuxiaobo@xuxiaobodeMacBook-Air ~
╰─$ git config user.name xuxiaobo

# git config user.email 要修改的邮箱
╭─xuxiaobo@xuxiaobodeMacBook-Air ~
╰─$ git config user.email 234***[email protected]

猜你喜欢

转载自blog.csdn.net/xuxiobo5/article/details/115127252
今日推荐