今天提交代码,push 到 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/wsgzao/wsgzao.github.io.git/': The requested URL returned error: 403
官方的解释:https://github.blog/changelog/2021-08-12-git-password-authentication-is-shutting-down/
As previously announced, starting on August 13, 2021, at 09:00 PST, we will no longer accept account passwords when authenticating Git operations on GitHub.com. Instead, token-based authentication (for example, personal access, OAuth, SSH Key, or GitHub App installation token) will be required for all authenticated Git operations.
Please refer to this blog post for instructions on what you need to do to continue using git operations securely.
Removal
- August 13, 2021, at 09:00 PST
大致意思是,密码验证于 2021 年 8 月 13 日不再支持,也就是今天 intellij 不能再用密码方式去提交代码。请用使用 personal access token 替代。
这个去年年底就说了,https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/
In July 2020, we announced our intent to require the use of token-based authentication (for example, a personal access, OAuth, or GitHub App installation token) for all authenticated Git operations. Beginning August 13, 2021, we will no longer accept account passwords when authenticating Git operations on GitHub.com.
自己鼓捣了一遍 Token,烦人的很。还是觉得直接 ssh 的方式操作 git 就好(之前是 ssh 的源,也没有这个问题)。
以下两种解决方案推荐使用 SSH 免密登录
# 登录 github 添加 SSH and GPG keys 公钥
# 修改 git config
vim wsgzao.github.io/.git/config
[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
hideDotFiles = dotGitOnly
[remote "origin"]
url = https://github.com/wsgzao/wsgzao.github.io.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
# 替换 url =
[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
hideDotFiles = dotGitOnly
[remote "origin"]
url = [email protected]:wsgzao/wsgzao.github.io.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
Google 搜索到以下文章具体步骤非常详细,我就直接贴链接不再重复了
1
icepie 2021-08-15 17:32:18 +08:00
原来如此, 我以为是开了二步验证的问题
|
2
lsvih 2021-08-15 17:37:53 +08:00 2
|
3
harwck 2021-08-15 17:39:59 +08:00
Token 哪里麻烦了?就设置一下权限就好了。
自从前几个月 GitHub 开始提醒的时候我就已经换到 Token 验证了。 |
4
dingwen07 2021-08-15 18:09:30 +08:00
一直都开着两步验证,这个变动应该没有影响
|
5
xiangyuecn 2021-08-15 18:12:28 +08:00
以前哪里填的密码,现在就在同样的位置填入 token 当做密码,大约 token == 密码 🐶
|
6
dingwen07 2021-08-15 19:34:08 +08:00 via iPhone
@xiangyuecn #5 密码可以用来生成 Token,但 Token 不能用于重置密码
|
7
Mitt 2021-08-15 19:47:17 +08:00
本来其实直接用账户的密码的方式就不太合理的
|
8
cweijan 2021-08-15 19:48:04 +08:00
现在把 token 当成密码就可以了, 比较麻烦的是需要清除掉以前保存的用户凭据
|
9
fpure 2021-08-15 19:55:54 +08:00
我想知道现在这个 token 是所有仓库共用一个 token 还是只能一个仓库一个 token ?
|
10
Rheinmetal 2021-08-15 20:08:17 +08:00
@fpure per repo 可以配 ssh key 吧
|
12
beginor 2021-08-15 21:16:12 +08:00 via Android
用 token 怎么试都不行,最后还是改用 ssh+key 了
|
13
Trim21 2021-08-16 07:55:31 +08:00 via Android
最简单的办法是把远程地址换成
https://username:[email protected]/username/repo.git |
14
Trim21 2021-08-16 07:58:44 +08:00 via Android 1
@Trim21 token 前面那个 username:也是可以省略掉的,直接 https://<token>@github.com/user/repo.git 也行
|
15
istevenshen 2021-08-16 09:58:47 +08:00
@Trim21 学习到了
|
16
ysc3839 2021-08-16 10:41:55 +08:00
个人觉得 token 并不麻烦,就只是把原来的密码换成 token,假如 token 麻烦的话原来用密码也一样麻烦。
相反个人觉得 SSH 反而麻烦,比如配置代理不能简单地指定一个 http proxy 。 |
17
Steaven 2021-08-16 15:04:03 +08:00
前天刚碰到这个问题,我还以为是因为我的库是私有库的原因。
|
18
zliea 2021-08-17 09:05:29 +08:00
一直在用 ssh 推,一直也不知道 0.0
|