有時候確實是密碼輸入錯誤,登陸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