fatal Authentication failed for httpsgithub.comxxxxxx.git解决方法
fatal: Authentication failed for ‘https://github.com/xxx/xxx.git/’解决方法
问题描述
学习git上传代码,然后让输入账号密码时报错.
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/xxx/xxx.git/'
我尝试过使用vsCode来连接git,在commit途中加载很久,最后出现弹窗显示:
解决方法
实际上命令行的报错已经给出了原因以及解决方法:
2021年8月13日移除对密码认证的支持。请改用个人访问令牌。详情请见https://github . blog/2020-12-15-token-authentic ation-requirements-for-git-operations/
说明我们当前使用的是密码认证,而密码认证早在2021年8月13日就已被移除。我们需要获取一个个人访问令牌。那么,如何获取呢?
于是我们来到https://github . blog/2020-12-15-token-authentic ation-requirements-for-git-operations/
个人访问令牌获取步骤
- 确保github上登录的是你要连接的用户;
- 点击个人资料-settings;
- 在左侧边栏中,点击<>Developer settings。
- 在左侧边栏中,点击Personal access tokens。
如果创建了一个再次创建
-
点击generate new token生成新令牌,这一步会要求你输入 GitHub 账号密码,以确认是你本人在操作,输入你的 GitHub 密码即可
-
设置令牌名字、有效期和权限
1、token做什么用的做个标注
2、token有效期
3、赋予token哪些权限
(建议勾选的权限包括)这个是其他博文看到的,还没有具体了解过
Repo(全部)
User(全部)
write:packages
write:discussion
admin:repo_hook
- 设置好后点击generate token
- 将令牌复制下来
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
注意!一定要复制保存到别的地方,一旦离开这个界面你就无法再次查看之前生成的令牌了。如果忘记了则需要重新生成。
- 之后就可以登录git并且上传代码了~
这里的username填写用户名,password填写之前复制下来的令牌,然后就能成功连上git!
从这里看出,上网查博客还是得找最新的教程哈。