Git:请求的 URL 返回错误:403 |身份验证不正确

Git: The requested URL returned error: 403 | incorrect authentication

提问人:Carlo Nazaire Morante 提问时间:11/17/2023 更新时间:11/19/2023 访问量:25

问:

完整上下文:我目前使用的是 Debian 系统,该系统Pop_OS!具体来说,我最近从 Windows 10 过渡到哪个,如果它是相关的。现在我目前正在做“python 的 100 天”,我现在已经成功地在 git 上提交了我需要的文件,但是当我将其推送到 github 时,我不小心使用我拥有的另一个帐户登录了。

所以现在在执行命令时,我得到这个:git push

remote: Permission to ActuallyCasealop/100-days-of-python.git denied to Casealop. fatal: unable to access 'https://github.com/ActuallyCasealop/100-days-of-python.git/': The requested URL returned error: 403

Actuallycasealop是预期的帐户,当提示将 github 连接到 git 时,我不小心登录了。我该如何纠正这个问题?casealop

linux git github debian

评论


答:

0赞 Moziii 11/19/2023 #1

您遇到的错误表明您正在使用的 GitHub 凭据无权推送到存储库。由于您不小心使用错误的 GitHub 帐户 () 进行身份验证,因此您需要将凭据更新为正确的帐户 ()。403ActuallyCasealop/100-days-of-python.gitCasealopActuallyCasealop

如果要直接更改已保存的凭据,可以使用:

git config --global credential.username "ActuallyCasealop"

更新此内容后,下次 时,系统应提示您输入密码。如果启用了双因素身份验证,您还可以使用个人访问令牌而不是密码。git push