GitLab has a mirror feature:
https://docs.gitlab.com/ee/user/project/repository/mirror/
and GitHub does not support simple password authentication. I tried to follow
https://meesvandongen.nl/posts/mirror-gitlab-github
Using the target url
ssh://[email protected]:stefaneidelloth/mirror_demo.git
and SSH public key as authentication method.
However, I get an error
Remote mirrors url is blocked: URI is invalid
from GitLab.
If I specify the target url
https://github.com/stefaneidelloth/mirror_demo.git
I am not able to select SSH public key as authentication method.
=> What are the right settings to mirror a GitLab project to a GitHub project (without PREMIUM edition of GitLab)?
Edit
The second : needs to be replaced with a /.
Suggested by GitHub:

Adding ssh:// prefix is not enough.
Wrong: ssh://[email protected]:stefaneidelloth/mirror_demo.git
Still need to replace : after github.com:
Right: ssh://[email protected]/stefaneidelloth/mirror_demo.git
Then GitLab generates the SSH key for the connection and one needs to copy it to the GitHub project settings (not the user settings), see https://meesvandongen.nl/posts/mirror-gitlab-github
Now I get the next error:
13:get remote references: create git ls-remote: exit status 128, stderr: "ssh connect to host github.com port 22: Connection timed out\r\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists.\n".
a) Do I need to specify a different port than 22? How? I tried
ssh://[email protected]:443/stefaneidelloth/mirror_demo.git
but that did not help.
b) Do I need to use "Input host keys manually"? What should be specified? I tried to use
SHA256:uNiVztksCsDhcc0u9e8BujQXVUpKZIDTMczCvj3tD2s
from
https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/githubs-ssh-key-fingerprints
but that did not help.
c) I also tried to generate a GitHub AccessToken in the user settings and apply it for the password option of the GitLab Mirror settings. I tried both, https:// and git:// urls. No success.
I got this to work after all.
ssh://[email protected]/stefaneidelloth/mirror_demo.git
"ssh connect to host github.com port 22: Connection timed out" suggests that something is blocking port 22 for github.com - perhaps a proxy or firewall. GitHub has a separate hostname (not github.com) for handling SSH traffic over a rarely-blocked port; your URL for that would need to be ssh://[email protected]:443/stefaneidelloth/mirror_demo.git.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With