title: Github令牌认证记录
date: 2021-08-16 14:10:29
tags: 记录
今天想起来把一些最近的文章放到博客上,让后上传的时候发现出报错了
一查才发现是Github更改的认证的方式,so,顺手记录一下,免得回头忘记了
解决方案:
打开Github的Settings->Developer settings->Personal access tokens新建一个token(Generate new token)
写个标题,选择token的有效期和一些需要的权限配置项,生成之后会得到一个token
mac上的使用:
打开钥匙串访问,搜索github.com项,找到种类是互联网密码的那一个,在简介里修改token就可以正常使用了。
windows:
从控制面板找到凭据管理器=> Windows 凭据=> 查找=>编辑=> 在密码中替换为你的Github 个人访问权限
linux:
配置本地 GIT 客户端
$ git config --global user.name ""
$ git config --global user.email ""
$ git config -l
使用token访问github
$ git clone https://github.com/YOUR-USERNAME/YOUR-REPOSITORY
> Cloning into `Spoon-Knife`...
$ Username for 'https://github.com' : username
$ Password for 'https://github.com' : give your personal access token here
记录令牌缓存
$ git config --global credential.helper cache
这是删除缓存的命令
git config --global --unset credential.helper