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/**.git/'
意思是自从21年8月13后不再支持用户名密码的方式验证了,需要创建个人访问令牌(personal access token)。
解决
生成令牌
首先生成一个令牌,←链接是官网教程,也可以不点,直接看下文。
1.点击Settings
![](https://img-blog.csdnimg.cn/769c706985c34a6d9482bda1ef9eb82f.png)
2. 点击左侧的Developer settings
![在这里插入图片描述](https://img-blog.csdnimg.cn/971892ac615a4e2f9c827569bdff5931.png)
3.点击Personal access tokens(个人访问令牌
![在这里插入图片描述](https://img-blog.csdnimg.cn/0171ed1c4a3140c8bafd90f091978979.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3lqdzEyMzQ1Ng==,size_16,color_FFFFFF,t_70)
4. 点击Generate new token
![在这里插入图片描述](https://img-blog.csdnimg.cn/874c5c48029e40e6b26a1d5a941d6981.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3lqdzEyMzQ1Ng==,size_16,color_FFFFFF,t_70)
5. 设置token信息
![在这里插入图片描述](https://img-blog.csdnimg.cn/5157223b935141658fc0d2ecfae819e3.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3lqdzEyMzQ1Ng==,size_16,color_FFFFFF,t_70)
点击Generate token生成令牌
6. 得到生成的令牌
![在这里插入图片描述](https://img-blog.csdnimg.cn/c1450c3ce0aa4c69a836147587f8b564.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3lqdzEyMzQ1Ng==,size_16,color_FFFFFF,t_70)
之后用自己生成的token
登录,把上面生成的token
粘贴到输入密码的位置
,然后成功push代码!
也可以 把token直接添加远程仓库链接中,这样就可以避免同一个仓库每次提交代码都要输入token了:
应用令牌
将生成的令牌拷贝下来(不要拷贝我的,拷贝你自己生成的!),记得保存,下次你就看不到了。
修改现有项目的url
git remote set-url origin https://<your_token>@github.com/<USERNAME>/<REPO>.git
将<your_token>
换成你自己得到的令牌。<USERNAME>
是你自己github的用户名,<REPO>
是你的项目名称,比如我的:
git remote set-url origin https://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@github.com/nlp-greyfoss/typora_notes.git/
其实上面的报错中就有提示,不需要重新去找:
fatal: unable to access 'https://github.com/<USERNAME>/<REPO>.git':
https://你的令牌@ \color{red}{\text{你的令牌@}}你的令牌@github.com/<USERNAME>/<REPO>.git
然后再执行git pull,世界又恢复原样了。
传新版本
对于全新版本,克隆的时候也在github.com
前面加个令牌就好了。
git clone https://<TOKEN>@github.com/<user_name>/<repo_name>.git
参考链接:
remote: Support for password authentication was removed on August 13, 2021_IT博客技术分享的博客-CSDN博客
【突发】解决remote: Support for password authentication was removed on August 13, 2021. Please use a perso_愤怒的可乐的博客-CSDN博客