删除了对密码身份验证的支持.请改用个人访问令牌 [英] Support for password authentication was removed. Please use a personal access token instead

查看:57
本文介绍了删除了对密码身份验证的支持.请改用个人访问令牌的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试使用 git pull 时,我的控制台出现了这个错误:

<块引用>

远程:2021 年 8 月 13 日取消了对密码身份验证的支持.请改用个人访问令牌.远程:请参阅 https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ 了解更多信息.致命:无法访问...";: 请求的 URL 返回错误:403

这很奇怪,因为两周前我只是按照文档在 GitHub 上创建了一个令牌,该令牌将于 2021 年 10 月 26 日星期二到期.为什么今天将其删除?

解决方案

从 2021 年 8 月 13 日起,GitHub 在对 Git 操作进行身份验证时不再接受帐户密码.您需要添加一个PAT(个人访问令牌),您可以按照以下方法在您的系统上添加一个 PAT.

<块引用>

在 GitHub 上创建个人访问令牌

从您的 GitHub 帐户,转到设置 =>开发者设置 =>个人访问令牌 =>生成新令牌(提供您的密码)=>填写表格 =>点击生成令牌 =>复制生成的Token,它会像ghp_sFhFsSHhTzMDreGRLjmks4Tzuzgthdvfsrta

现在根据您的机器遵循以下方法:

<块引用>

对于 Windows 操作系统

控制面板转到凭据管理器 =>Windows 凭据 =>找到 git:https://github.com =>编辑 =>在 Password 替换为您的 GitHub 个人访问令牌 =>你完成了

如果你没有找到 git:https://github.com =>点击添加通用凭据 =>Internet 地址将是 git:https://github.com,您需要输入您的用户名和密码将是您的 GitHub 个人访问令牌 =>点击确定,你就完成了


<块引用>

对于 macOS

单击菜单栏右侧的 Spotlight 图标(放大镜).输入 Keychain access 然后按 Enter 键启动应用 =>在 Keychain Access 中,搜索 github.com =>找到 github.com => 的 互联网密码条目相应地编辑或删除条目=>大功告成


<块引用>

对于基于 Linux 的操作系统

对于Linux,需要使用用户名配置本地GIT客户端和电子邮件地址,

$ git config --global user.name "your_github_username";$ git config --global user.email "your_github_email";$ git 配置 -l

一旦 GIT 配置完毕,我们就可以开始使用它来访问 GitHub.示例:

$ git clone https://github.com/YOUR-USERNAME/YOUR-REPOSITORY>克隆成勺子刀"...$ 'https://github.com' 的用户名:用户名$ 'https://github.com' 的密码:在此处提供您的个人访问令牌

现在在您的计算机中缓存给定的记录以记住令牌:

$ git config --global credential.helper 缓存

如果需要,您可以随时通过以下方式删除缓存记录:

$ git config --global --unset credential.helper$ git config --system --unset credential.helper

现在尝试用-v拉取来验证

$ git pull -v

<块引用>

Linux/Debian(克隆如下):

git clone https://@github.com/dadenewyyt/react-projects.git


<块引用>

对于 PhpStorm

如果您使用 PhpStorm,请转到菜单 Git =>通过个人访问令牌拉取并选择身份验证.输入您的 PAT 它将允许拉/推更改.

I got this error on my console when I tried to use git pull:

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 "..." : The requested URL returned error: 403

It's very weird, because I just follow the documentation and created a token two weeks ago on GitHub that expires on Tue, Oct 26, 2021. Why has this been removed today?

解决方案

From August 13, 2021, GitHub is no longer accepting account passwords when authenticating Git operations. You need to add a PAT (Personal Access Token) instead, and you can follow the below method to add a PAT on your system.

Create Personal Access Token on GitHub

From your GitHub account, go to Settings => Developer Settings => Personal Access Token => Generate New Token (Give your password) => Fillup the form => click Generate token => Copy the generated Token, it will be something like ghp_sFhFsSHhTzMDreGRLjmks4Tzuzgthdvfsrta

Now follow below method based on your machine:

For Windows OS

Go to Credential Manager from Control Panel => Windows Credentials => find git:https://github.com => Edit => On Password replace with with your GitHub Personal Access Token => You are Done

If you don’t find git:https://github.com => Click on Add a generic credential => Internet address will be git:https://github.com and you need to type in your username and password will be your GitHub Personal Access Token => Click Ok and you are done


For macOS

Click on the Spotlight icon (magnifying glass) on the right side of the menu bar. Type Keychain access then press the Enter key to launch the app => In Keychain Access, search for github.com => Find the internet password entry for github.com => Edit or delete the entry accordingly => You are done


For a Linux-based OS

For Linux, you need to configure the local GIT client with a username and email address,

$ git config --global user.name "your_github_username"
$ git config --global user.email "your_github_email"
$ git config -l

Once GIT is configured, we can begin using it to access GitHub. Example:

$ git clone https://github.com/YOUR-USERNAME/YOUR-REPOSITORY
> Cloning into `Spoon-Knife`...
$ Username for 'https://github.com' : username
$ Password for 'https://github.com' : give your personal access token here

Now cache the given record in your computer to remembers the token:

$ git config --global credential.helper cache

If needed, anytime you can delete the cache record by:

$ git config --global --unset credential.helper
$ git config --system --unset credential.helper

Now try to pull with -v to verify

$ git pull -v

Linux/Debian (Clone as follows):

git clone https://<tokenhere>@github.com/dadenewyyt/react-projects.git


For PhpStorm

If you are using PhpStorm, go to menu Git => pull and select authentication via Personal Access Token. Enter your PAT it will allow to pull/push the changes.

这篇关于删除了对密码身份验证的支持.请改用个人访问令牌的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆