首页 > 解决方案 > git clone 不工作并出现错误“要访问此存储库,您必须使用带有个人访问令牌的 HTTPS 远程或带有 SSH 密钥的 SSH”

问题描述

尝试运行命令时 Git 抛出以下错误

git clone <<clone url>>:
remote: this repository, you must use the HTTPS remote with a personal access token
remote: or SSH with an SSH key and passphrase
remote: that has been authorized for this organization. Visit
remote: https://docs.github.com/articles/authenticating-to-a-github-organization-with-saml-single-sign-on/ for more information. The requested URL returned error: 403

如错误中所述,我浏览了 url- https://docs.github.com/articles/authenticating-to-a-github-organization-with-saml-single-sign-on/,并按照步骤进行了配置SSL 授权。

此外,我按照以下 url 生成新的 SSH 密钥并存储在 SSH 代理中的步骤:https ://docs.github.com/en/github/authenticating-to-github/connecting-to-github-with-ssh /generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent

在此处输入图像描述

另外,我已经配置了个人访问令牌。下面是截图:

在此处输入图像描述

尽管如此,我还是遇到了与上述相同的错误。

如果需要更多信息,请告诉我。

标签: gitssh

解决方案


检查一下,对于您的 SSH 密钥,您是否拥有(如此处):

  • 启用 SSO
  • 授权您的组织

然后再试一次,使用 SSH URL

git clone git@github.com:<organization>/<repo>

推荐阅读