Github -- Personal access tokens

3,004 阅读1分钟

今天在更新blog到GitHub的时候 出现了下图的问题

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/XXX/XXX.git/': The requested URL returned error: 403

查找文档后 发现了是8月13后 GitHub 不能再用密码推/拉 需要使用令牌 (不影响ssh的方式)

具体设置如下 github.com/settings/to…

进入 Github --> Settings --> Developer settings --> Personal access tokens

点击 Generator new tokens 生成 个人令牌

过期时间和权限都可以在这里设置 设置完成后 请记住你的token

然后在你的仓库中输入以下命令 就可以啦 🥳

git clone https://<TOKEN>@github.com/<user_name>/<repo_name>.git

or

git remote set-url origin https://<TOKEN>@github.com/<user_name>/<repo_name>.git