git,github记得错误的帐户 [英] git, github remembers wrong account

查看:90
本文介绍了git,github记得错误的帐户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始使用git和github.com。对于测试,我使用account1创建了一个repo,然后导入并提交更改,并推送。都好。然后我创建了另一个帐户(account2),将它们克隆到我的计算机上的另一个文件夹,然后进行了一些更改,然后推送。

奇怪的是,'git log'命令显示最后一次'推送'的作者是account1,而不是account2。这个评论显然是我从account2创建的,但作者很混乱。



我使用的客户端是在MINGW32上运行的GitBash,我已经尝试关闭/重新启动客户多次,没有希望。任何人都有同样的问题? Tks

解决方案

检查您的全局配置是否包含 user.email 设置为 account1 的电子邮件地址。



电子邮件地址是GitHub确定作者的参数提交。



请参阅此问题的说明 Git author Unknown



正如 demas 答案,您需要在每个回购的本地git配置中设置该信息: git config user.email ...

这样,即使您拥有全局配置,当您从一个配置中推送时也不会有任何身份识别问题,或者其他回购。


I'm starting using git and github.com. For a test, I created a repo using account1, then import and commit changes, pushed. All good. Then I created another account (account2), cloned them to another folder on my computer, made some changes then pushed.

Oddly enough, the 'git log' command shows that the author that did the last 'push' is account1, not account2. The comment is explicitly the one I made from account2, but the author is messed up.

The client I use is GitBash running on MINGW32, I already tried closing/restarting the clients several times, no hope. Anybody got the same problem? Tks

解决方案

Check if your global config doesn't include user.email set to account1's email address.

The email address would be the parameter on which GitHub determines the author of a commit.

See as an illustration of this issue "Git author Unknown".

As mentioned in demas's answer, you need to set that information in the local git config for each repo: git config user.email ....
That way, even if you have a global config, you won't have any identification issue when you push from one or the other repo.

这篇关于git,github记得错误的帐户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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