问题原因:
账号密码验证不通过,密码或者权限不对,导致 Git 操作失败
解法一:删除 credential.helper
git config --system --unset credential.helper
然后输入Git远程服务器的新密码。
然后还是不行:
git config --system --unset credential.helper
然后输入Git远程服务器的新密码。
解法二:Mac 配置ssh
cd ~/.ssh
ls -a //查看是否已经存在
如果没有生成新的ssh key
ssh-keygen -t rsa -C "email@.com"
将id_rsa.pub中的内容复制,然后在GitHub或者Gitlab点击add ssh key
在 git push 代码时报remote: HTTP Basic: Access denied
git config --global credential.helper osxkeychain
之后再操作git push 或者 git pull 输入正确的用户名与密码
解法三:删除mac 钥匙串
Delete the password in keychain access.
- cmd+space and type “KeyChain Access”,
- You should find a key with the name like “gitlab.*.com Access Key for user”. You can order by date modified to find it more easily.
- Right click and delete.