git 自动提交脚本 push 后显示的是别人的帐号(确定邮箱不是那个人的)

2020-10-01 11:38:24 +08:00
 DeathWing

一开始无聊写了个脚本,本地测试了一下,可以自动提交代码。随后丢到服务器上。今天一看 git log,日志显示:Author: ubuntu ubuntu@localhost.localdomain ,随后检查 git config --list,user.name 和 user.email 都是我自己的没错,那到此我觉得可能脚本哪里不完善。

重点来了!!!

我登录 github 看的时候,这个提交的头像竟然是路飞??还是个国人,一看这个人的资料写的是 wensjtuer@gmail.com 。我在想,难道这个人的 github 注册邮箱是 ubuntu@localhost.localdomain ?不可思议。。。

3912 次点击
所在节点    git
20 条回复
DeathWing
2020-10-01 11:52:26 +08:00
[Imgur]( )
ericwood067
2020-10-01 11:59:00 +08:00
[]( https://docs.github.com/en/free-pro-team@latest/github/committing-changes-to-your-project/why-are-my-commits-linked-to-the-wrong-user)

Commits are linked to another user
If your commits are linked to another user, that means the user has added the email address in your local Git configuration settings to their GitHub account. In this case, you can change the email in your local Git configuration settings and add the new email address to your GitHub account to link future commits to your account.
DeathWing
2020-10-01 12:03:20 +08:00
@ericwood067 那他把 ubuntu@localhost.localdomain 加到了他账户里?这。。好像说不通
ericwood067
2020-10-01 12:08:37 +08:00
@DeathWing 应该是这样的,github 的 settings 里有一个 Emails,里面有一个 Add email address 的选项。
Kr98
2020-10-01 12:09:56 +08:00
@ericwood067 关键是他怎么通过邮箱验证的
uTOmOuk3L6sb4MSI
2020-10-01 13:42:23 +08:00
我用 mac 和 ios 提交,头像不一样。
一个是旧的头像,一个是新的头像。

用的 vscode 和 working copy
sola97
2020-10-01 14:00:12 +08:00
我也遇到过
DeathWing
2020-10-01 14:21:32 +08:00
@ODD10 但是用户是一个用户吧?我这个路飞头像是可以直接到另一个帐号的= =哈哈
DeathWing
2020-10-01 14:21:45 +08:00
@sola97 和我一模一样的情况?
DeathWing
2020-10-01 14:22:40 +08:00
@Kr98 我觉得应该不是路飞小哥绑了那个邮箱=。=
Exin
2020-10-01 22:00:37 +08:00
羡慕你们有头像的,我总是显示不出头像来
BIAOXYZ
2020-10-01 23:22:38 +08:00
把本地所有的 config 都核对一下( git config -l + --system/--global/--local )。
lxilu
2020-10-01 23:35:29 +08:00
前贴 Github 奇葩项目提到伪造作者或可参考
DeathWing
2020-10-02 20:22:36 +08:00
@lxilu 搜了一下 没怎么找到~方便的话 能不能贴一下链接 我去观摩下
DeathWing
2020-10-02 20:22:54 +08:00
@Exin - -?为啥显示不出来
DeathWing
2020-10-02 20:26:16 +08:00
@BIAOXYZ 这个不是主要问题,主要是脚本 commit 的时候用的 ubuntu@localhost.localdomain,而这个邮箱在 github 上对应的是路飞头像。
另外,config 这个第一时间确认过了,除了 system 没有设置外其他都是我自己。我后来推测是因为在我的环境下使用 subprocess 读取不到 user config,所以我在脚本里每次提交前添加了一下 username 和 Email 就搞定了。主要是路飞这个太诡异了=。=
yanqiyu
2020-10-03 01:37:27 +08:00
建议发邮件直接请教
lxilu
2020-10-03 10:39:51 +08:00
DeathWing
2020-10-09 18:16:31 +08:00
@yanqiyu If you add an email to your account, and commit using that email, it will be attributed to your account. It doesn’t need to be verified.
DeathWing
2020-10-10 09:18:30 +08:00
简单复现了一下,确实只要在账户设置里添加邮箱,不需要验证。
基本结帖啦。后续无聊想验证的可以用 abcd@localhost.localdomain,应该也会显示我的猫头像

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/712058

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX