我愿意更新我的 GitHub 用户名,以便与其他网站和社交媒体更加一致和可识别。
Git commits that were associated with your GitHub-provided noreply email address won't be attributed to your new username and won't appear in your contributions graph. If your Git commits are associated with another email address you've added to your GitHub account, including the ID-based GitHub-provided noreply email address, they'll continue to be attributed to you and appear in your contributions graph after you've changed your username. For more information on setting your email address, see "Setting your commit email address."
具体是什么意思?如果我理解正确,如果我更改我的用户名,我的提交将不再归于我吗? “noreply 电子邮件地址”和“基于 ID 的 noreply 电子邮件地址”的正确含义是什么? 如何确定我的提交是否与一个或另一个相关联?
换句话说,如何在更改用户名之前检查我是否会丢失提交属性?
请注意,我在本地工作,git config --list | grep email
给我user.email=<my-real-email>@gmail.com
.
最佳答案
另一个答案主要回答了这个问题,但还有一个额外的考虑因素。您可以将您的提交归因于您的新用户名即使您一直使用 GitHub 的无回复电子邮件地址,具体取决于地址的外观。文档中的关键段落如下:
Note: If you created your GitHub account after July 18, 2017, your GitHub-provided
no-reply
email address is a seven-digit ID number and your username in the form ofID+username@users.noreply.github.com
. If you created your GitHub account prior to July 18, 2017, your GitHub-providedno-reply
email address is your username in the form ofusername@users.noreply.github.com
. You can get an ID-based GitHub-providedno-reply
email address by selecting (or deselecting and reselecting) Keep my email address private in your email settings.If you use your GitHub-provided
noreply
email address to make commits and then change your username, those commits will not be associated with your GitHub account. This does not apply if you're using the ID-based GitHub-providednoreply
address. For more information, see "Changing your GitHub username."
较旧的无回复地址是基于用户名的,因此与您的 GitHub 用户名相关联。如果您的提交使用了这样的地址,那么它们将继续归属于旧用户名,并且不会切换到您的新用户名。如果后来有人使用旧用户名,这些提交将归于该用户。
自 2017 年 7 月 18 日起,GitHub 通过向无回复地址添加 ID 更改了此功能。此 ID 现在与您的帐户相关联,并且与您的用户名无关。如果您有一个基于 ID 的地址,更改用户名仍然会将来自该地址的所有提交归于您。但是,如果您在基于 ID 的地址发布之前开始使用 GitHub 的无回复电子邮件功能,您将继续使用旧形式的地址,除非您明确重新选择该选项,如注释所述。
总而言之,提交将在用户名更改后继续归因于您的帐户,如果:
- 提交使用了与您的 GitHub 帐户关联的电子邮件地址。
- 提交使用了 GitHub 提供的基于 ID 的无回复电子邮件地址。
关于git - 更改 GitHub 用户名时提交归属?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63690503/