昨天一气之下把sourcetree删了以后,在终端git push时遇到了:
192:Machine-Reading-Comprehension-Chinese baowudi$ git push
remote: Permission to sweetbao/Machine-Reading-Comprehension-Chinese.git denied to sweetbao.
fatal: unable to access 'https://github.com/sweetbao/Machine-Reading-Comprehension-Chinese.git/': The requested URL returned error: 403
然后看了Mac系统 Git远程克隆仓库出现Permission denied (publickey) 如何生成私钥、公钥,关于如何生成SSH key的教程,但我的SSH key是在github的setting里已经配好的,于是进入~/.ssh文件夹后id_rsa,id_rsa.pub已经存在(顺便把sourcetree生成的一些key给删了)
重新打开github->setting->SSH and GPG keys后,点开自己生成的key发现,没有给这个key配置任何权限...
?肉眼可见 全是空的,于是把一些repo/write/delete之类的权限都给了以后继续push,这次错误变得不一样了!
192:Machine-Reading-Comprehension-Chinese baowudi$ git push
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: Authentication failed for 'https://github.com/sweetbao/Machine-Reading-Comprehension-Chinese.git/'
发现github在8.13弃用了登录密码,而我的~./gitconfig里面还写着
[remote "origin"]
url = https://<password>@github.com/<username>/<project-name>.git
fetch = +refs/heads/*:refs/remotes/origin/*
<password>:登录密码
<username>:用户名
<project-name>:项目名称
于是重新在github生成token了以后,把<password>字段换成token,具体教程见:
github开发人员在七夕搞事情:remote: Support for password authentication was removed on August 13, 2021.
192:Machine-Reading-Comprehension-Chinese baowudi$ git push
Enumerating objects: 78, done.
Counting objects: 100% (78/78), done.
Delta compression using up to 8 threads
Compressing objects: 100% (73/73), done.
Writing objects: 100% (76/76), 2.90 MiB | 2.14 MiB/s, done.
Total 76 (delta 13), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (13/13), done.
To https://github.com/sweetbao/Machine-Reading-Comprehension-Chinese.git
03bdc64..e763be6 main -> main
成功啦!撒花!
|