I have just installed GitLab.
I created a project called project-x.
I have created few users and assigned it to the project.
Now I tried to clone:
Had the same problem in Windows 10 (don't know if this is relevant).
Had everything set up correctly, the ssh -vT git@myserver
command succeeded, but Gitlab still asked for my password.
Removing then re-creating the key in Gitlab was the trick for me.
I had the same problem, I spent a lot of time searching!
I had the idea to use Eclipse to import the project from GitLab.
Once the project is imported correctly, I made the comparison between the configuration of :
Surprise: The remote does not have the same in both cases. I handed the same as that in eclipse and everything works.
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 git@192.168.0.108
is working first.
I am using a mac.gitlab is installed in a centos server.
I have tried all the methods above and found the final answer for me:
wrong:
ssh-keygen -t rsa
right:
ssh-keygen -t rsa -C "your.email@example.com" -b 4096
For my case, it turns out the gitlab was runnign in docker
, and has port mapping 4022/22.
Thus I have to edit ~/.ssh/config
to specify the port via Port 4022
, e.g:
Host gitlab-local
Hostname 192.168.1.101
User git
Port 4022
IdentityFile ~/.ssh/id_rsa.pub
# LogLevel DEBUG3
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!