Advanced Site Tools
Why can't I clone a Git repo from my GitLab account?

Why can't I clone a Git repo from my GitLab account?

You should connect to GitLab’s second SSH server, which listens on port 443. In order to do that, you should navigate to the .ssh directory in your account’s home folder. The full path to that folder would be /home/customer/.ssh. Find a file named config in it, or create a new file with that name if it does not exist. Open the file for editing and add the lines below:

Host gitlab.com
Hostname altssh.gitlab.com
User git
Port 443
PreferredAuthentications publickey
IdentityFile ~/.ssh/gitlab

This means that when you try to connect to GitLab.com, the connection will be established towards the altssh.gitlab.com hostname via port 443.

The next step here is to find the private part of the SSH key you added in GitLab.com and save it in the /home/customer/.ssh/gitlab file.

After you apply the above changes, you should be able to connect to your GitLab account successfully. The first time you connect to altssh.gitlab.com, you will be asked to verify the server’s key fingerprint, but this is normal. You may check that the fingerprint is the same as in GitLab.com and type in yes to continue connecting.

Share This Article