Git 设置 root 的 Committer 为 User-name
如果 git 没有设置 root 账户下的 user-name 和 user email,在 root 下 push 代码时,Committer 就可能变成 root,git 提交信息可能是下面这样:
由于之前没有在 root 下设置 user-name,因此这次在 root 下的提交中, Committer 变成了 root。可以根据提示的命令来设置 root 下的 git user-name。
先执行:
git config --global --edit
将 name 和 email 开头处的“#”注释符去掉,然后把 name 和 email 改成 git 系统用户下的 user-name 和 user-email。这样在 root 下提交时, Committer 就变成了我们设置的 user-name 而不是 root 了。
之后通过下面的命令编辑这次的 commit 信息:
git commit --amend --reset-author
最后在 root 下 push 的时候,Committer 就会显示成 user-name。