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