remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/**.git/'
 

意思是自从21年8月13后不再支持用户名密码的方式验证了,需要创建个人访问令牌(personal access token)。

解决

生成令牌

首先生成一个令牌,←链接是官网教程,也可以不点,直接看下文。

1.点击Settings

 2. 点击左侧的Developer settings

在这里插入图片描述

 3.点击Personal access tokens(个人访问令牌

在这里插入图片描述

4. 点击Generate new token

在这里插入图片描述

 5. 设置token信息

在这里插入图片描述

 点击Generate token生成令牌

6. 得到生成的令牌

在这里插入图片描述

 

之后用自己生成的token登录,把上面生成的token粘贴到输入密码的位置,然后成功push代码!

也可以 把token直接添加远程仓库链接中,这样就可以避免同一个仓库每次提交代码都要输入token了:

应用令牌

将生成的令牌拷贝下来(不要拷贝我的,拷贝你自己生成的!),记得保存,下次你就看不到了。

修改现有项目的url

git remote set-url origin  https://<your_token>@github.com/<USERNAME>/<REPO>.git

<your_token>换成你自己得到的令牌。<USERNAME>是你自己github的用户名,<REPO>是你的项目名称,比如我的:

git remote set-url origin  https://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@github.com/nlp-greyfoss/typora_notes.git/

其实上面的报错中就有提示,不需要重新去找:

fatal: unable to access 'https://github.com/<USERNAME>/<REPO>.git':

https://你的令牌@ \color{red}{\text{你的令牌@}}你的令牌@github.com/<USERNAME>/<REPO>.git

然后再执行git pull,世界又恢复原样了。


传新版本

对于全新版本,克隆的时候也在github.com前面加个令牌就好了。

git clone https://<TOKEN>@github.com/<user_name>/<repo_name>.git

参考链接:

remote: Support for password authentication was removed on August 13, 2021_IT博客技术分享的博客-CSDN博客

【突发】解决remote: Support for password authentication was removed on August 13, 2021. Please use a perso_愤怒的可乐的博客-CSDN博客

Logo

瓜分20万奖金 获得内推名额 丰厚实物奖励 易参与易上手

更多推荐