一觉醒来突然发现怎么没法往github上push代码了呢,这好恐怖~ 还好还好,不是github罢工,只是需要使用token而已。
Git password authentication is shutting down
As previously announced, starting on August 13, 2021, at 09:00 PST, we will no longer accept account passwords when authenticating Git operations on GitHub.com. Instead, token-based authentication (for example, personal access, OAuth, SSH Key, or GitHub App installation token) will be required for all authenticated Git operations.
Please refer to this blog post for instructions on what you need to do to continue using git operations securely.
Removal
August 13, 2021, at 09:00 PST
来自github通知
创建 token
先登录自己的github,找到setting
note 可以随便写
token的有效期可以设置,如果怕麻烦,可以设置为无期限。
可以为不同的用户(组)生成不同的token,给予不同的token不同的权限。自己个人用的话,全选就可以了。
把生成的token复制下来。
使用token
原来输入密码的时候,输入生成的token就可以了
$ git clone https://github.com/username/repo.git
Username: your_username
Password: your_token
详细过程参考这里
现在再push一下,成功了!
$ git push --set-upstream origin master
Enumerating objects: 205, done.
Counting objects: 100% (205/205), done.
Delta compression using up to 8 threads
Compressing objects: 100% (203/203), done.
Writing objects: 100% (205/205), 618.80 KiB | 5.68 MiB/s, done.
Total 205 (delta 79), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (79/79), done.
To https://github.com/akstuki/CMQA.git
* [new branch] master -> master
Branch 'master' set up to track remote branch 'master' from 'origin'.