github 使用秘钥

警告
本文最后更新于 2021-09-12,文中内容可能已过时。

错误提示如下:

1
2
3
4
5
6
7
8
git push origin master

Alias tip: gp origin master
Username for 'https://github.com': williamlfang
Password for 'https://williamlfang@github.com':
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/williamlfang/blog.git/'

参考:How to fix the GitHub Support for password authentication error

  • To fix the error, follow the below steps:
    1. Open GitHub.com, click on your profile picture, then click on settings.
    2. Now, scroll to the bottom of a page and click on the Developer settings tab.
    3. Now, click on Personal access tokens and generate a new token by giving the name and expiration date, etc.
    4. Once you successfully generated the Personal access token copy it.
    5. Now, open the Git repository where you got the error and remove the current origin by running the following command.
1
2
3
4
5
git remote remove origin

git remote add origin https://<Token>@github.com/williamlfang/blog.git

git push --set-upstream origin master

相关内容

william 支付宝支付宝
william 微信微信
0%