GitLab git user password
Solution 1:
Not strictly related to the current scenario. Sometimes when you are prompted for password, it is because you added the wrong* origin format (HTTPS instead of SSH)
HTTP(S) protocol is commonly used for public repos with strong username+pass
SSH authentication is more common for internal projects where you can authenticate with a ssh-key-file and simple pass-phrase
GitLab users are more likely to use the SSH protocol
View your remote info with
git remote -v
If you see HTTP(S) address, this is the command to change it to SSH:
git remote set-url origin [email protected]_domain.com/example-project.git
Solution 2:
It prompted me for password.
It shouldn't.
If you have the right public/private key representing a user authorized to access project-x
, then gitlab won't ask you for anything.
But that supposes that ssh -vT [email protected]
is working first.
Solution 3:
The Solution from https://github.com/gitlabhq/gitlab-shell/issues/46 worked for me.
By setting the permissions:
chmod 700 /home/git/.ssh
chmod 600 /home/git/.ssh/authorized_keys
password prompt disappears.
Solution 4:
I had this same problem when using a key of 4096 bits:
$ ssh-keygen -t rsa -C "GitLab" -b 4096
$ ssh -vT git@gitlabhost
...
debug1: Offering public key: /home/user/.ssh/id_rsa
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /home/user/.ssh/id_dsa
debug1: Trying private key: /home/user/.ssh/id_ecdsa
debug1: Next authentication method: password
git@gitlabhost's password:
Connection closed by host
But with the 2048 bit key (the default size), ssh connects to gitlab without prompting for a password (after adding the new pub key to the user's gitlab ssh keys)
$ ssh-keygen -t rsa -C "GitLab"
$ ssh -vT git@gitlabhost
Welcome to GitLab, Joe User!
Solution 5:
This can happen if the host has a '-' in its name. (Even though this is legal according to RFC 952.) (Tested using Git Bash under Windows 10 using git 2.13.2.)
ssh prompts me for a password for any host that happens to have a '-' in its name. This would seem to be purely a problem with ssh configuration file parsing because adding an alias to ~/.ssh/config (and using that alias in my git remote urls) resolved the problem.
In other words try putting something like the following in your C:/Users/{username}/.ssh/config
Host {a}
User git
Hostname {a-b.domain}
IdentityFile C:/Users/{username}/.ssh/id_rsa
and where you have a remote of the form
origin [email protected]:repo-name.git
change the url to use the following the form
git remote set-url origin git@a:repo-name.git