我之前使用 git bash 作为本地存储库。
我已连接到 GitHub 帐户,并且总是毫无问题地推送我的文件。
后来,我卸载了 bash 并使用新用户和电子邮件重新安装。现在,当我尝试将文件推送到远程时,出现错误:
Permission to SyedMiraj/SpringSecurityWithTicketBooking.git denied to biid-sua.
unable to access 'https://github.com/SyedMiraj/SpringSecurityWithTicketBooking.git/': The requested URL returned error: 403
我已尝试创建一个新的 SSH 密钥并将其添加到远程存储库中。
但问题仍然存在,说实话我无法将任何东西推送到我的遥控器上。
我的两个 GitHub 帐户是 biid-sua 和 smiraj。
您建议如何恢复 GitHub 推送?
这里有几点:
- 用于提交的用户和电子邮件与用于身份验证的远程存储库(此处托管在 GitHub 上)无关
- SSH 密钥(旧的或新的)是not当使用以下命令推送到 GitHub 时完全使用https URL.
如果它使用您的第一个biid-sua
帐户,这是因为 git 凭证助手,它已经缓存了您的biid-sua
的凭证github.com
.
您可以确认并删除该条目(在 Mac 上 https://stackoverflow.com/a/47967883/6309 or 在 Windows 上 https://stackoverflow.com/a/47466980/6309)。下次推送时,系统将提示您输入新的用户名/密码。
或者您可以切换到 SSH URL:
cd /path/to/my/local/repo
git remote set-url origin g2:SyedMiraj/SpringSecurityWithTicketBooking.git
然后确保你的~/.ssh/config
定义了g2
输入和引用右键(正如我在这里解释的 https://stackoverflow.com/a/14681936/6309)
#Account one
Host g1
HostName github.com
PreferredAuthentications publickey
IdentityFile /c/Users/yourname/.ssh/id_rsa_biid-sua
User git
#Account two
Host g2
HostName github.com
PreferredAuthentications publickey
IdentityFile /c/Users/yourname/.ssh/id_rsa_smiraj
User git
假设您已在 HOME 中命名 SSH 密钥:
-
.ssh/id_rsa_biid-sua
and .ssh/id_rsa_biid-sua.pub
-
.ssh/id_rsa_smiraj
and .ssh/id_rsa_smiraj.pub
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)