尝试推送到 Git 存储库时出现 403 错误

Getting 403 error when trying to push to Git repo

我在尝试将更改推送到 Git 存储库时遇到错误 https://github.com/covid19india/covid19india-react.git

我在 Windows 7 上使用 Tortoise Git 并使用 https。我能够使用相同的用户克隆存储库。

问题可能出在哪里?

git.exe push --progress "origin" refactor_switch_route
fatal: HttpRequestException encountered.
An error occurred while sending the request.
remote: Permission to covid19india/covid19india-react.git denied to myusername.
fatal: unable to access 'https://github.com/covid19india/covid19india-react.git/': The requested URL returned error: 403


git did not exit cleanly (exit code 128) (14258 ms @ 17-05-2020 17:37:03)

一定是您被禁止访问该存储库,或者您没有所需的访问权限或身份验证。可能验证错误。

看看这个 https://www.a2hosting.in/kb/developer-corner/version-control-systems1/403-forbidden-error-message-when-you-try-to-push-to-a-github-repository

我在尝试推送到我单独工作的一个存储库的特定分支时遇到了同样的问题。我尝试按照建议进行操作,但没有用...对我有用的是将存储库添加到 Github 桌面并从那里推送它。我知道这不是 解决方案 但它是一种解决方法。

今天尝试 运行 $ git push origin main 我 运行 遇到这个问题,Github 似乎不再允许您从终端使用密码。您必须使用个人访问令牌 (PAN) 或 2 Factor Authentication.

1- 这里有一些非常简单的带图片的说明 setup a PAN. If for some reason the link doesn't work you can follow the directions directly from Github

2- 创建 PAN 后,如果您使用的是 Mac,请按照此 SO answer 将您的 PAN 添加到钥匙串。它 100% 有效

经过以上2个简单的步骤$ git push origin main一切正常