【问题标题】:How can I change my github account? [duplicate]如何更改我的 github 帐户? [复制]
【发布时间】:2018-03-27 11:59:40
【问题描述】:

如何更改我的 github 帐户?

当我在终端上输入git push 时,我收到了这条消息:

远程:myAccount/myProject.git 的权限被拒绝给 mySecondAccount。 致命:无法访问'https://github.com/myAccount/myProject.git/':请求的URL返回错误:403

我已经用过git config --global user.namegit config --global user.email

但是没有效果。

【问题讨论】:

  • 也许您的存储库中有本地 git 配置选项(不会使用全局选项)
  • 尝试 git config user.namegit config user.email 看看你是否有该存储库的本地 git 配置。
  • @srxf 当我输入git config user.namegit config user.email 时,输出是myAccountNamemyAccountEmail。但仍然出现错误 403。
  • 您是使用 ssh 还是手动输入用户名和密码?

标签: git github


【解决方案1】:

在网上找到这个

“远程:myAccount/myProject.git 的权限被拒绝给 mySecondAccount。致命:无法访问 'https://github.com/myAccount/myProject.git/':请求的 URL 返回错误:403”

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

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

如果您使用的密钥是部署密钥,请查看我们的部署密钥指南了解更多详情。

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

【讨论】:

    【解决方案2】:

    首先,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。根据您的操作系统,这可能会有所不同,但想法保持不变。

    【讨论】:

      猜你喜欢
      • 2016-08-20
      • 2014-05-09
      • 2012-06-09
      • 2017-05-30
      • 2021-08-23
      • 2016-12-20
      • 2012-03-22
      • 1970-01-01
      相关资源
      最近更新 更多