最新消息:20210917 已从crifan.com换到crifan.org

【已解决】git push提交Gitlab的仓库报错:Push failed remote HTTP Basic Access denied Authentication failed

Git crifan 1591浏览 0评论
用IntelliJ IDEA去git push提交代码到Gitlab的git仓库,结果报错:
18:56:49.658: [ruleClean] git -c credential.helper= -c core.quotepath=false -c log.showSignature=false push --progress --porcelain origin refs/heads/master:master
remote: HTTP Basic: Access denied
fatal: Authentication failed for 'http://xxx:xxx/xxx/ruleclean.git/‘

Push failed remote: HTTP Basic: Access denied Authentication failed for 'http://xxx:xxx/xxx/ruleclean.git/'
去找找
gitlab Push failed remote HTTP Basic Access denied Authentication failed
使用git报错 – remote: HTTP Basic: Access denied_付出总会有收获!-CSDN博客
git – GitLab remote: HTTP Basic: Access denied and fatal Authentication – Stack Overflow
git – GitLab: Remote access denied fatal – authentication failed – Stack Overflow
关于git:GitLab remote:HTTP Basic:拒绝访问和致命身份验证 | 码农家园 (codenong.com)
感觉是:需要去Gitlab后台看看,把密码访问,换掉,换成 token 密钥等方式访问
其中:
关于git:GitLab remote:HTTP Basic:拒绝访问和致命身份验证 | 码农家园 (codenong.com)
很明显是:翻译过来的。
数据源估计是:StackOverflow的
去找原始帖子
果然找到了:
git – GitLab remote: HTTP Basic: Access denied and fatal Authentication – Stack Overflow
发现上面已经找到的帖子就是。。
其中的回复是
“For me, the following worked:
Do not use your GitLab password, but create an access token and use it instead of your password:
1. In GitLab, go to Settings > Access Tokens
2. Create a new token (check api)
3. git clone …
4. When you are asked for your password, copy and paste the access token instead of your GitLab password
所以去Gitlab中看看
登录到Gitlab中
去找:access token
Settings > Access Tokens
其中:
Repository Settings
有个:
Deploy Tokens
Deploy tokens allow read-only access to your repository and registry images.
貌似是的,点击:Expand 看看效果
感觉不太像的样子:应该和deploy没关系吧
后记:
Deploy tokens allow read-only access to your repository
只有只读权限,看来不是我们要的。
我们要的是:可以完全access git repo的权限
后来还是自己研究出来了:
点击右上角用户头像 -》Settings
其中左边有个:Access Tokens
肯定就是这个了:
看到的是:
之前2019年早就创建过了一个token了。
所以:此处是:去找到之前的token,然后去用token即可。
“1. When you are asked for your password, copy and paste the access token instead of your GitLab password”
即:此处 Access Token,几乎等价于 (你的)git(账号的)密码
所以,在git push等弹出的 账号和密码输入框中,对于密码,直接输入此 Access Token,即可。
找到之前的 Access Token了:
然后重新去(此处的IntelliJ IDEA的git push中去)git push:
点击Push,在出现的:
git的账号和密码弹框中,密码部分,粘贴使用此处的 Access token 
点击Log in,即可。
即可成功push:
To http://x:x/xxx/ruleclean.git
     refs/heads/master:refs/heads/master    add6ade..8966ef1
Done
【总结】
Gitlab中的git仓库
当本地git仓库改动后,已commit,再去git push时,弹框让输入 账号和密码
输入了 正确的账号和密码
但是push失败,报错:
Push failed remote: HTTP Basic: Access denied Authentication failed for
原因:
不支持普通的git的密码
而支持,应该,改用:Gitlab账号中的Access Token
解决办法:
去Gitlab中创建Personal Access Token,然后git弹框输入密码时,用access token(而不要用密码)
步骤:
(1)Gitlab中创建Personal Access Token
  • Gitlab右上角Profile-》Settings-》(左边)Access Tokens
  • Access Tokens页:输入name,全部勾选(api、read_user、read_repository、write_repository),点击Create personal access token
    • 记住你的token
(2)git push等操作时,需要输入密码的地方,输入(刚才你创建的)access token即可
已回复帖子:
补充到了 JavAlex 的回复中:
git – GitLab remote: HTTP Basic: Access denied and fatal Authentication – Stack Overflow
git – GitLab: Remote access denied fatal – authentication failed – Stack Overflow

转载请注明:在路上 » 【已解决】git push提交Gitlab的仓库报错:Push failed remote HTTP Basic Access denied Authentication failed

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
94 queries in 0.180 seconds, using 23.30MB memory