使用Github的AccessToken提交代码(新)

1,536 阅读1分钟

一、前言

当前github上传代码已经不能再使用用户名+密码的方式提交代码了,而改用了access token的方式提交代码到github。 github 报错如下图所示:

image.png

打开博客:github.blog/2020-12-15-…

大概意思就是

对密码认证的支持于2021年8月13日被删除。请使用个人访问令牌代替。

二、申请Access Token

1.登录github,点击头像,选择Settings

image.png

2.选择Developer settings

image.png

3.选择Personal access tokens

image.png

4.选择General new token

image.png

5.设置生成参数

image.png

  • 1.Note:描述access token的用途;
  • 2.Expiretion:有效期;
  • 3.Select Scopes:设置权限范围.

6.最后点击General token

image.png

7.最终到得access token

image.png

注意:保存access token

三、使用Access token

使用access token生成仓库地址(前提是需要先在github创建好仓库)

https://(your_access_token)@github.com/(your_path).git

  • 1.your_access_token就是上面申请的access token;
  • 2.your_path是仓库路径,例如下图,your_path = xiongjinhui/sort_algorithms:

image.png

现在就可以使用这个仓库地址提交代码到github了。

image.png

End