In GitLab, I own a group, and within this group I have a private repository.
It's url looks like this: https://gitlab.com/groupname/reponame
.
On my machine, I have an ssh key pair id_rsa_gitlab
& id_rsa_gitlab.pub
.
I have added the public key in GitLab settings. And I have added the following code in my ~/.ssh/config
:
# GitLab.com
Host gitlab.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa_gitlab
I have tested that the communication works using ssh -T git@gitlab.com
as in the docs.
Now, I would like to clone my group's private repo. But unfortunately, none of the following works without manually typing my GitLab username and password (not the password of the SSH key, but the password for my GitLab account).
# Asks for username and pass and then clones successfully
git clone https://gitlab.com/group/repo
git clone https://gitlab.com/group/repo.git
git clone https://git@gitlab.com/group/repo
git clone https://<myGitLabUser>@gitlab.com/group/repo
# Asks only for password and then clones successfully
git clone https://<myGitLabUser>@gitlab.com/group/repo.git
# Asks only for password and then fatal: Authentication failed for '...'
git clone https://git@gitlab.com/group/repo.git
# fatal: repository '...' does not exist
git clone git@gitlab.com/group/repo
git clone git@gitlab.com/group/repo.git
git clone <myGitLabUser>@gitlab.com/group/repo
git clone <myGitLabUser>@gitlab.com/group/repo.git
What am I doing wrong? Is this not possible?