尝试推送到 github 时如何修复 403 错误?

How can I fix 403 error when trying to push to github?

我最近从一个朋友那里得到了一台笔记本电脑,他还安装了 github 之类的东西。我将我的凭据添加到 gitconfig,添加了用户名和电子邮件,但我没有更改密码,因为我不确定如何更改。我认为这就是我收到此错误的原因:

(rizumu 是我朋友的用户名 - 因为我更改了用户名,我很困惑为什么它仍然用他的用户名称呼我)

remote: Permission to hannarosenfeld/brnhrz-cms.git denied to rizumu. fatal: unable to access 'https://github.com/hannarosenfeld/brnhrz-cms.git/': The requested URL returned error: 403

由于 403 错误是由于身份验证无效,您可以尝试再次克隆代码并尝试使用个人访问令牌(而不是密码)。以下链接可能有帮助 https://docs.github.com/en/get-started/getting-started-with-git/setting-your-username-in-git https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token