GitHub 已停止支持 Git 密码验证

今天在往 GitHub 仓库 push 代码时出现错误Support for password authentication was removed,请求时会返回 403 错误。具体如下:

$ git push
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/wbt5/real-url.git/': The requested URL returned error: 403

Support for password authentication was removed

看意思是:从 2021 年 8 月 13 日开始,已移除在 Git 客户端上使用账号密码的验证方式,之后都要用基于令牌的身份验证来确保 Git 操作的安全,比如 personal access、OAuth、SSH Key、GitHub App installation token 都是可以的。

这里用最快捷解决办法:

1、先要去 GitHub 账户中获取一个 Personal access tokens:Settings -- Developer settings -- Personal access tokens -- Generate new token,填入 Note,Expiration 我设置的是永不过期,下面 Select scopes 全选,Generate token 后复制。

2、在 Git bash 中输入:git remote set-url origin https://<生成的token>@github.com/用户名/仓库名即可。

话说现在 GitHub 越来越难登陆了,链接经常被重置或超时。

» 链接地址:https://wbt5.com/github-authentication.html »英雄不问来路,转载请注明出处。

GitHub 已停止支持 Git 密码验证》上有 1 条评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注