赞
踩
最近使用github提交本地仓库代码,发现始终提示报错:
fatal: unable to access 'https://github.com/.......': OpenSSL SSL_read: Connection was reset, errno 10054
起先是以为本地账户有问题了,在取消本地证书认证,重新输入账号密码,提交的时候有报错:
- 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: unable to access 'https://github.com/<USERNAME>/<REPO>.git': The requested URL returned error: 403
仔细看了下才知道,2021年8月13后本地账户不再支持使用用户名和密码的方式登录了,需要创建个人访问令牌(personal access token)。
github的token申请还是很简单得。
1、登录github网站后点击用户名,进入设置(https://github.com/settings/tokens)
2、进入设置后点击左侧菜单的Developer settings
3、进入页面点击Personal access tokens,另外两个视需要设置,自己的本地账户就用这个。
4、点击右上角Generate new token,开始设置个人token
5、填写名字后,先选择有效日期,自己用就选无期限的,还可以勾选上所有权限。然后确认即可
6、token生成好了,注意,不要急着关。这个token只显示一次,应该先复制保存下。否则你只能再生成一次。
好了,token生成好了,但是,该怎么用呢?很简单,在使用github时,想正常操作,github工具会弹出登录输入框。这里使用的password不再是之前填写的密码,而应该时填写刚刚获取的token(再次提醒:请提前复制保存这个token)
好了,现在这个项目使用正常了。使用token去克隆新项目则不用再验证提交。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。