github无法提交代码问题
问题描述
提交代码到个人仓库的时候发现报错,认证失败
Username for 'https://github.com': hywing
Password for 'https://hywing@github.com':
remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/hywing/rt-thread.git/'
解决办法
在GitHub页面点击右上角个人logo
,选择Settings
进入Settings页面
在Settings
页面拉到最下方点击Developer Settings
在Developer Settings页面依次点击Personal access tokens
,Token (classic)
,Generate new token
,Generate new token (classic)
填写口令信息,点击Generate token
,点击你所需要的访问权限,然后拷贝口令
然后你需要通用的url格式来验证你对远程仓库的控制权限
https://刚刚拷贝的口令@github.com/你的用户名/你的仓库名称.git
将生成的口令拷贝,作为 git clone仓库的前缀,我的口令是随意填写的,这里要填你自己的token口令
git clone https://aaa_bbbKoJyB0oJbuQYjJOILugksoT9VB93TTTTT@github.com/hywing/rt-thread.git
如果已有仓库可以通过set url的方式更新token
git remote set-url origin https://aaa_bbbKoJyB0oJbuQYjJOILugksoT9VB93TTTTT@github.com/hywing/rt-thread.git
这样,你就可以顺利对远程仓库进行操作了