身份验证已被删除。请改用个人访问令牌

shu*_*dav 14 git github git-clone personal-access-token private-repository

尝试连接 GitHub 时出错:

remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.
remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information.
fatal: unable to access 'https://github.com/ershubhamyadav/dream365web.git/': The requested URL returned error: 403
Run Code Online (Sandbox Code Playgroud)

shu*_*dav 25

请按照以下简单步骤获取解决方案。

  1. 前往 GitHub
  2. 单击个人资料图片
  3. 选择设置
  4. 选择开发者设置
  5. 选择个人访问令牌
  6. 单击生成新令牌
  7. 类型 过期时间
  8. 选择您的首选范围
  9. 单击生成令牌
  10. 最后,您可以复制该令牌并使用它进行身份验证

  • 我生成了它如何使用它?此致 (9认同)
  • 要将其用于现有存储库,您可以更新 .git 文件夹中的配置文件并将令牌插入源中,因此 url = https://github.com/yourrepo 变为 url = https://<tokenhere>@github .com/ (5认同)

Gil*_*tal 17

  1. 按照以下步骤创建访问令牌: https: //docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token
  2. 将存储库的 URL 更改为:https://<access token>@github.com/userName/repo.git

如果在詹金斯上,请将凭据设置为无。


小智 14

首先生成令牌,因为 Github 在对 Git 操作进行身份验证时不再接受帐户密码,并要求从 2021 年 8 月 13 日开始使用基于令牌的身份验证。

如何生成令牌 转到设置,然后进入开发人员设置 ,然后选择个人访问令牌(第三个选项)单击右上角的“生成新令牌”按钮输入注释,选择到期日期,然后检查范围选项并单击底部的生成按钮。复制生成的令牌。这就是我们将用下面第二条指令中的令牌替换的内容。

git remote add origin https://github.com/username/directory-name.git
git remote set-url origin https://<token>@github.com/username/directory-name.git
git branch -M main
git push -u origin main
Run Code Online (Sandbox Code Playgroud)

这可以解决您的问题


小智 5

当我尝试将本地目录中的项目推送到 GitHub 目录时,我遇到了同样的问题,然后尝试按照以下步骤操作: