remote: HTTP Basic Access denied
起因
我的
ldap
账号更换了密码,导致我的gitlab
的代码没办法pull
和push
了,比较糟心
报错信息
git --no-optional-locks -c color.branch=false -c color.diff=false -c color.status=false -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree fetch origin
remote: HTTP Basic: Access denied
fatal: Authentication failed for 'http://gitlab.tsingj.local/poc/ds.git/'
remote: HTTP Basic: Access denied
报错图片如下:
解决步骤
git config --system --unset credential.helper
我的是mac,如果提示
error: could not lock config file /etc/gitconfig: Permission denied
说明权限不够,进入sudo
% su root
git config --system --unset credential.helper
改完提示我钥匙串出了什么问题,没遇到过,百度一下
参考1
后来发现 git pull
的时候都需要输入用户名和密码
于是在终端里输入
sh-3.2# git config --global credential.helper store
输入后会保存你的密码,然后在pull 一下,会提示输入用户名和密码
git pull
更改了钥匙串后,在sourceTree 中拉一次代码时出现下列图片,输完密码后即可正常使用sourceTree
了