|# Assume we are in your home directory|
|# Clone the repo from GitLab using the `--mirror` option|
|$ git clone --mirror email@example.com:mario/my-repo.git|
|# Change into newly created repo directory|
|$ cd ~/my-repo.git|
|# Push to GitHub using the `--mirror` option. The `--no-verify` option skips any hooks.|
|$ git push --no-verify --mirror firstname.lastname@example.org:mario/my-repo.git|
|# Set push URL to the mirror location|
|$ git remote set-url --push origin email@example.com:mario/my-repo.git|
|# To periodically update the repo on GitHub with what you have in GitLab|
|git fetch -p origin|
|git push --no-verify --mirror|
I'm assuming you do mean the push command so it's github that is complaining about public key failure.
Have you got one key pair for both sites, or two different pairs?
You might want to check your key work before you run this script, this doc page includes a link to testing your public key is installed correctly.
This is working well for me in reverse -- importing github to gitlab. Using the other methods didn't work because:
Thanks for the script!
I had the below issue when using gitlab and github from the same computer(windows).
Please make sure you have the correct access rights
and the below steps solved the issue.
Ideally this should succeed
Anyone finding this in 2020+, there is a very convenient import method from Gitlab now as well:
After authorization on GitHub you'll be taken to https://gitlab.com/import/github/status for easy import management.