我曾经在Github上有一个账号(Mariogs37),但现在已经不再使用。与此同时,我创建了一个新的账号(bclayman),并且想要开始使用它。我在Github上创建了一个仓库,并运行了以下命令:
git remote add origin https://github.com/bclayman/SquashScraper.git
我没有收到任何错误信息,然后我运行:
git push -u origin master
然而,我收到了以下错误消息:
remote: Permission to bclayman/SquashScraper.git denied to Mariogs37.
fatal: unable to access 'https://github.com/bclayman/SquashScraper.git/': The requested URL returned error: 403
我在谷歌上搜索了类似的问题,并找到了这个链接:
http://stackoverflow.com/questions/24019258/git-thinks-im-the-wrong-user
我按照vonC的回答指示进行操作(在这里:https://help.github.com/articles/generating-ssh-keys/#step-3-add-your-ssh-key-to-github)。在将我的SSH密钥添加到github的最后,我在终端中得到了以下内容:
Hi bclayman! You've successfully authenticated, but GitHub does not provide shell access.
我尝试将本地存储库推送到Github,但遇到了同样的错误。有任何想法为什么它仍然认为我是Mariogs37(因此没有权限推送到由bclayman拥有的Github存储库)吗?
谢谢, bclayman
.gitconfig
吗?还要检查一下这个:http://superuser.com/questions/232373/how-to-tell-git-which-private-key-to-use - Jörn Hees