Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to mirror a private repository on gitlab.com using the SSH protocol?

Gitlab.com has an option to mirror other repository's on their own site. (Project--> Project setting--> Mirror Repository)

But when I tried to do that using the ssh protocol, the authorization failed because the repository I wanted to clone didn't recognize the public key of Gitlab.com.

The page stated:

If your SSH repository is not publicly accessible, add the public SSH key of the GitLab server to the remote repository.

The thing is, I could not find an option to add a private key to Gitlab.com or download a public key from Gitlab.com.

Is this only possible if your own a GitLab server or did I overlook something?

like image 254
Lena Avatar asked Nov 23 '15 16:11

Lena


2 Answers

Gitlab mirroring feature is implemented recently on Nov 2015 but unfortunately it is available only for Gitlab Enterprise Edition:

Repository Mirroring (EE only) If you want to maintain a mirror of a repository in a GitLab instance, you can now let GitLab handle the mirroring for you automatically in GitLab Enterprise Edition.

Check the features comparison between Community and Enterprise Editions Either you request EE or use gitlab-mirrors scripts:

The gitlab-mirrors project is designed to fill in a feature which is currently missing from GitLab: the ability to mirror remote repositories. gitlab-mirrors creates read only copies of remote repositories in gitlab. It provides a CLI management interface for managing the mirrored repositories (e.g. add, delete, update) so that an admin may regularly update all mirrors using crontab. It operates by interacting with the GitLab API using python-gitlab3. Also, check out this cool puppet module for installing and configuring gitlab-mirrors.

like image 145
Assem Avatar answered Oct 20 '22 01:10

Assem


I'm not sure that this will work, but I reckon it's worth a try. To retrieve the public key of gitlab.com, I ran the following command:

nmap gitlab.com --script ssh-hostkey --script-args ssh_hostkey=all

The following 3 public keys can then be found in the output:

ssh-dss AAAAB3NzaC1kc3MAAACBAMPKInNPflcRle9F5Qt2j9aI0EZuWQzdXTbYvsl+ChaacqCOWRMiOmXHXqetFz6jD/6Fcqg20ZATxqSskQBaRn97O/mbH+GQk4d3zw9WAEURicE8rKJop3qGtdfFxLzrTuPAkKRDMmutT3hwZIOO8CFWOl1BiuUYTncJTeonrfAAAAFQCujauoy3Yy+ul72b/WsTECUPj9yQAAAIBIV2yyF7RZf7IYS8tsWcKP7Y5Bv9eFdbvbtsaxcFCHcmHIGoJQrIdPoueoOb5EUTYz0NgYKsKaZzDZkgFk28GsmLxKvhnPjaw0lJVSKRchEE5xVlamOlabiRMjQ7X/bAdejkBJe96AjZZL3UO4acpwfy3Tnnap0w6YCDeaxoyHpwAAAIAU+dyNaL3Hy15VIV32QwWMekvxeptUY/W03LNcgZZDoin87TE9xuQhM0qF3pi2i2a2ExuslgdttmYWvrbEz8eW+RFgvT5pKwWpalKWetHvtN3oYZP37ZIO1Y3Hd5A4YVcpYp1ccRayveLlCRwxb4HdGXT2OmYU+lmvimIR8zQ6A==

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCsj2bNKTBSpIYDEGk9KxsGh3mySTRgMtXL583qmBpzeQ+jqCMRgBqB98u3z++J1sKlXHWfM9dyhSevkMwSbhoR8XIq/U0tCNyokEi/ueaBMCvbcTHhO7FcwzY92WK4Yt0aGROY5qX2UKSeOvuP4D6TPqKF1onrSzH9bx9XUf2lEdWT/ia1NEKjunUqu1xOB/StKDHMoX4/OKyIzuS0q/T1zOATthvasJFoPrAjkohTyaDUz2LN5JoH839hViyEG82yB+MjcFV5MU3N1l1QL3cVUCh93xSaua1N85qivl+siMkPGbO5xR/En4iEY6K2XPASUEMaieWVNTRCtJ4S8H+9

_ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFSMqzJeV9rUzU4kWitGjeR4PWSa29SPqJ1fVkhtj3Hw9xjLVXVYrU9QlYWrOLXBpQ6KWjbjTDTdDkoohFzgbEY=

Adding these to your repository server might allow it to authenticate the connection properly.

like image 45
Martin Wiboe Avatar answered Oct 19 '22 23:10

Martin Wiboe