git push origin master denied to user X其中x不是本地git配置中的用户

问题描述:

将此前缀与我对git和github非常陌生。 我建立在github回购,为用户ZZZ,它是在我的地方(具体回购)混帐配置文件,里面有像下面,当我做'git config --local --list'条目正确列出:git push origin master denied to user X其中x不是本地git配置中的用户

remote.origin.url=https://github.com/zzz/myrepo.git 
user.name=zzz 
[email protected] 

但是,当我做的是git push origin master,它得到403被拒绝给用户'xxx' ...一个用户,它对应一个完全独立的github帐户。我该如何解决?当它不是我在本地配置文件中仔细指定的用户时为什么会选择用户'xxx'?我在Windows 7机器上。

的Git存储凭证在Windows中,清除它们指下图:

enter image description here

运行您git push命令,它会提示您再次输入凭据。

图片提供 - Remove credentials from Git

+0

那工作!但是,如果我想在同一台机器上使用git作为2个不同的用户呢?对于某些回购,我想成为用户Z,对于其他我想成为用户X的用户。每次我都会清除我的Windows凭据?只是好奇... – yen

+0

这可能会帮助你在这种情况下 - https://*.com/questions/3860112/multiple-github-accounts-on-the-same-computer – Arpit