zl程序教程

您现在的位置是:首页 >  其他

当前栏目

【解决】remote: Support for password authentication was removed on August 13, 2021. Please use a persona

2023-04-18 12:31:15 时间

问题

今天提交PR的时候遇到无法提交PR的问题,报错提示:

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/LDOUBLEV/PaddleOCR/': The requested URL returned error: 403

大无语事件,过个节后就没法提交PR了-_-

看了下链接里的内容,修改意见如下:

意思就是说,如果是你之前是密码登陆的,现在需要用token登陆; OK,那就好整了;

解决步骤

  1. 生成token
  2. 使用token代替密码

生成token

首先,登陆github 网站,点击网页右上角头像,依次找到 SettingDevelop Setting

找到developer Settings

生成新的token,可以把repo部分选上,其余按需选择即可;

生成token后,注意复制保存,后续会用到,否则刷新页面,就无法查看token了;

使用token代替密码

  1. 情况1: 如果提交PR时,需要输入账号名称和密码,密码替换为token即可
  2. 情况2: 密码已经默认设置好了,设置你的远程分支的url:
git remote set-url myrepo https://<your token>/<your github name>/<your project name>

或者先删掉之前的remote,重新add

git remote rm myepo
git remote add myrepo  https://github.com/LDOUBLEV/PaddleOCR

其中myrepo为我设置的我分支的名字,可以git remote -v 看到你的repo和fork其他repo的名字 另外需要填写token 。github 账号的名字,和 project 名字, 例子如下

git remote set-url myrepo  https://ghp_*********************************@github.com/LDOUBLEV/PaddleOCR.git

设置好后,即可往我的repo中提交PR了

git push myrepo my_branch