如何更改 GitHub 中提交的作者? [英] How to change the author of a commit in GitHub?

查看:65
本文介绍了如何更改 GitHub 中提交的作者?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有办法更改在 GitHub 存储库中推送更改的人员(帐户).

I want to know if there is a way to change the person(account) who pushed changes in a GitHub repository.

例如:我以不同的名称(不是电子邮件)推送到我的私人存储库,但我拼错了我名字的一个字母,GitHub 将提交标记为用户名而非用户名提交;

For example: I push to my private repository under a different name(not email) but I misspell one letter of my name and GitHub marks the commit as commited by userame not username;

推荐答案

我建议你修复提交者.请记住,提交的用户和提交者之间是有区别的.提交者在 .git/config 文件夹中签名:

I suggest you to fix the committer. Remember that there is a difference between the user who commit, and the committer. The committer is signed inside .git/config folder:

$ cat .git/config
[user]
    name = John Doe
    email = john.doe@example.com

现在,您只需要git commit --amendgit push origin BRANCH -f.前一个命令再次提交(但这次更新了提交者).后者,覆盖分支.

Now, you just need to git commit --amend and git push origin BRANCH -f. The former command commit again (but this time with the committer updated). The latter, overwrite the branch.

这篇关于如何更改 GitHub 中提交的作者?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆