如何更改我的github帐户?

时间:2017-10-16 02:49:54

标签: git github

如何更改我的github帐户?

当我在终端上输入git push时,我会收到以下消息:

  

remote:对mySecondAccount拒绝myAccount / myProject.git的权限。   致命:无法访问' https://github.com/myAccount/myProject.git/':请求的网址返回错误:403

我已使用git config --global user.namegit config --global user.email

但没有效果。

2 个答案:

答案 0 :(得分:1)

在网上找到这个

" remote:对mySecondAccount拒绝myAccount / myProject.git的权限。致命:无法访问' https://github.com/myAccount/myProject.git/':请求的网址返回错误:403"

此错误表示您推送的密钥作为部署密钥附加到另一个存储库,并且无权访问您尝试推送到的存储库。

要解决此问题,请从存储库中删除部署密钥,然后将密钥添加到您的用户帐户中。

如果您使用的密钥是部署密钥,请查看我们的部署密钥指南以获取更多详细信息。

https://help.github.com/articles/error-permission-to-user-repo-denied-to-user-other-repo/

答案 1 :(得分:1)

首先,user.name和user.email与使用https URL推送到GitHub时用于进行身份验证的凭据(用户名/密码)无关。

当您使用https时,您的凭据有可能(再次:用户名/密码)were cached by a credential helper:输入git config credential.helper进行确认。

如果是这种情况,您需要删除https://github.com的条目并再次按下:系统会要求您提供新的凭据。
here for an example when using Git for Windows。根据您的操作系统,可能会有所不同,但想法保持不变。