-
问题描述
在本地电脑执行以下操作的时候
git remote add origin https://github.com/957625959/-.git
git branch -M main
git push -u origin main
在使用 Git 上传将本地仓库推送到远程服务器时,出现了以下问题:
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/957625959/-.git/'
其实是2021年 8 月 13日,github中通过 用户名然后输入密码的认证方式被移除了,只能通过个人访问码的方式进行认证。
-
解决方案
在github上创建访问码,步骤如下:
- 点击settings
- 点击developer settings

- 找到tokens(classic)
- 全部勾选

- 点击Generate token

- 现在已经得到token,然后正常输入username,密码替换成token即可
本文描述了在使用Git将本地仓库推送到GitHub时因2021年8月13日后认证方式改变导致的问题。解决方案是通过GitHub设置创建个人访问令牌,用生成的token替换密码进行认证。

894





