2014-05-08 48 views
2

我已经开始尝试使用git和github。我创建了一个存储库,我试图发布。我得到类似如下的错误:Git似乎卡在我的旧帐户

 
$ git push origin master 

ERROR: Permission to myuser/MyProject.git denied to OldAccount. 
fatal: could not read from remote repository 

Please make sure you have the correct access rights and the repository exists 

让我吃惊的是,混帐以为我是OldAccount。那是我一年前在第一次使用git时创建的用户名。我今天决定创建一个新帐户,并试图使用我的新帐户,但git不断尝试使用我的旧帐户进行发布。我正在使用GitHub for Windows应用程序,并且它绝对登录到我的新的帐户。那么OldAccount怎么还在弹出呢?

回答

1

检查还您git config user.email

电子邮件必须与您的新帐户,而不是旧的一个相关联的。
(即由最近的答案为“Git commits associated with old, defunct user instead of the user I have now”所示)

和关于推动,确保您的网址是不是在它的HTTPS一个与你的旧登录:

htps://[email protected]/newLogin/newRepo 

(类型远程Git -v看到 'origin' URL)

如果它使用SSH URL,然后如前所述,检查你的公钥:

+0

运行'git的远程-v'产生的URL'[email protected]:mynewuseraccount/MyRepo.git'。我运行了'git config user.email',并显示正确的电子邮件地址。 – FrustratedWithFormsDesigner

+0

您发布的链接建议我运行'git config --global --edit'并验证用户和电子邮件。我运行了该命令,并从旧用户帐户的最近存储库列表中看到旧存储库。一旦我摆脱那些我能够发布变化。 – FrustratedWithFormsDesigner

0

我认为你的公共SSH密钥仍然添加到你的旧帐户。