Cannot setup push mirror to GitHub. NONE OF THE GUIDE WORKS.

I am trying to use GitLab push mirroring to GitHub, for my first time ever.

I read through every single line about mirroring GitLab repository, from here and here. Unfortunately, NONE OF THE GUIDE WORKS.

My repositories to do the experiment

I started out both of them as plain blank repos with no commits, not even including README.md and LICENSE.

What I have tried

1. Use Password Authentication, with personal access token on GitHub

I followed the guide Set up a push mirror from GitLab to GitHub to its entirety. Unfortunately, this guide does not help because GitHub has removed support for password authentication.

In the repository settings I entered the following:

Then I got this error:

13:push to mirror: git push: exit status 128, stderr: "remote: Support for password authentication was removed on August 13, 2021.\nremote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.\nfatal: Authentication failed for 'https://github.com/ytxmobile98/gitlab-mirror-test.git/'\n".

So I then attempted to try the SSH way.

2. Use SSH public key (detect host keys)

Now I try using SSH public key. Here is what I have entered:

Then I clicked Detect host keys and got three fingerprints, each starting with SHA256:

SHA256:***********************
SHA256:***********************
SHA256:***********************
  • Authentication method: SSH public key

Again it runs into an error when syncing:

13:get remote references: create git ls-remote: exit status 128, stderr: "*****@github.com Permission denied (publickey).\r\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists.\n".

3. Use SSH public key (import host keys manually)

Here is what I entered:

This time, instead of clicking Detect host keys, I chose Import host keys manually.

Before taking the steps below, I added the SSH public key I generated on my computer to GitHub.

  • SSH host key: I copy-pasted the SSH public key into the box
  • Authentication method: SSH public key

Now again it runs into error:

13:get remote references: create git ls-remote: exit status 128, stderr: "No ECDSA host key is known for github.com and you have requested strict checking.\r\nHost key verification failed.\r\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists.\n".

At this moment I am feeling desperate and helpless.

Did I setup my either repo wrongly? Or did I miss any important steps?

Why is there no guide at all regarding how to push mirror from GitLab to GitHub using SSH?

What should I do to get things work?

Edited by Tianxing Yang