idea中git更新代码时报错:Update failed;remote: HTTP Basic: Access denied…
具体报错信息如下:Update failed;remote: HTTP Basic: Access denied. The provided password or token is incorrect or your account has 2FA enabled and you must use a personal access token instead of a password. See http://127.0.0.1:80/help/topics/git/troubleshooting_git#error-on-git-fetch-http-basic-access-denied;Authentication failed for ‘http://127.0.0.1:glpat-7dtg-xNsM1NeCkjwo3es@127.0.0.1:80/xxxxx/service.git/’
这个错误表明 Git 认证失败了,具体原因是:
- 提供的密码或令牌不正确
- 或者你的账户启用了双重认证(2FA),必须使用个人访问令牌(PAT)而不是密码
解决方案
1. 确认是否启用了2FA
如果你的 Git 账户(如 GitLab)启用了双重认证,你必须使用个人访问令牌(PAT)而不是密码。
2. 使用正确的认证方式
对于 GitLab
- 登录到你的 GitLab 账户
- 在右上角点击头像 > “P