remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.

报错: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/sober-orange/study.git/‘: The requested URL returned error: 403

原因:自2021年8月13日起,github不再支持使用密码push的方式


解决方案:两种
一、 使用SSH
二、使用Personal access token

看此博文需要具备git命令相关知识,最起码你得知道git push、git remote是干嘛的

法一

点击此链接跳转至方法详情

法二

首先,需要获取token

  1. 点击你的GitHub头像 -> 设置 -> 开发者设置 -> Personal access tokens -> Generate new token

  2. 生成tokenremote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.

  3. 复制token
    remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.

  4. 使用token进行push(clone,pull同理),虽然都是使用token的方式解决,但是还是有一些细微不同,因此进行了细分

直接push

此方法每次push都需要输一遍token,很是费劲啊

# git push https://你的token@你的仓库链接,我这里是我的仓库链接你要改成你的
git push https://你的token@github.com/sober-orange/study.git

remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.

修改remote别名

这种方式在push的时候直接指明别名就可
如果你已经设置过remote别名,使用如下命令

# 我这里的别名是origin
# git remote set-url 你的remote别名 https://你的token@你的仓库地址
git remote set-url origin https://你的token@github.com/sober-orange/study.git
# 提交代码
git push -u origin master

如果你未设置过别名,使用如下命令添加别名

# git remote add 别名 https://你的token@你的仓库地址
git remote add origin https://你的token@github.com/sober-orange/study.git
# 提交代码
git push -u origin master

使用Git Credential Manager Core (GCM Core) 记住token

git push
Username: 你的用户名
Password: 你的token
# 记住token
git config credential.helper store

使用Windows的凭据管理器

  1. 打开凭据管理器 -> windows凭据
  2. 找到“git:https://github.com”的条目,编辑它
  3. 用 PAT 访问令牌替换你以前的密码
    remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.

参考文献


https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token

https://docs.github.com/en/get-started/getting-started-with-git/caching-your-github-credentials-in-git

remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.

上一篇:SQL SERVER备份数据库到共享目录


下一篇:Mysql8.0版本之前和之后远程登录设置