gitlab HTTP Basic: Access denied问题解决方法

有时候确实是密码输入错误,登陆gitlab重置下密码。

gitlab的https用户定义密码认证方式被关闭了,那就改成ssh方式
在项目根目录:

git remote set-url origin git@git.example.com:test.git 

将项目从https源换成ssh

本机生成SSH Key

ssh-keygen -t rsa -C "your_email@example.com" 

cat ~/.ssh/id_rsa.pub
将ssh-key放到gitlab -- settings -- SSH Keys

Username for 'https://git.example.com': zhang
Password for 'https://zhang@git.example.com': 
remote: HTTP Basic: Access denied
remote: You must use a personal access token with 'read_repository' or 'write_repository' scope for Git over HTTP.
remote: You can generate one at https://git.example.com/profile/personal_access_tokens
fatal: Authentication failed for 'https://git.example.com/zhang/test.git/'

 

其它:
账号密码改过:
git config –system –unset credential.helper 重新输入新账号密码
如不能解决:
git config –global http.emptyAuth true

posted @ 2020-07-10 20:17  船长博客  阅读(9003)  评论(0编辑  收藏  举报
永远相信美好的事情即将发生!