推送代码报错:fatal: unable to access 'https://gitlab.com/xxx/xxx.git/': The requested URL returned error: 403
- 错误还原
# gitlab使用Bitbucket注册登录,执行 git push 命令,使用token验证报错如下
dogle@DESKTOP-KI961IK MINGW64 /d/workspaces/xxx (main)
$ git push
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 https://gitlab.com/help/topics/git/troubleshooting_git#error-on-git-fetch-http-basic-access-denied
fatal: Authentication failed for 'https://gitlab.com/xxx/xxx.git/'
dogle@DESKTOP-KI961IK MINGW64 /d/workspaces/xxx (main)
$ git push
remote: You are not allowed to push code to this project.
fatal: unable to access 'https://gitlab.com/xxx/xxx.git/': The requested URL returned error: 403
-
解决方案
-
将默认浏览器设置为gitlab登录的浏览器
-
git push推送
-
点击授权
-
成功
-
控制台显示成功
dogle@DESKTOP-KI961IK MINGW64 /d/workspaces/xxx (main)
$ git push
warning: ----------------- SECURITY WARNING ----------------
warning: | TLS certificate verification has been disabled! |
warning: ---------------------------------------------------
warning: HTTPS connections may not be secure. See https://aka.ms/gcm/tlsverify for more information.
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 16 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 284 bytes | 284.00 KiB/s, done.
Total 3 (delta 1), reused 0 (delta 0), pack-reused 0 (from 0)
To https://gitlab.com/xxx/xxx.git
85f3850..5903408 main -> main
- 查看控制面板凭证