Last active
May 6, 2024 20:05
-
-
Save nuno-azevedo/fd6aa4ef0ccb153d5d375465b74158dd to your computer and use it in GitHub Desktop.
Import Repository from GitLab to GitHub
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Arguments: | |
# ${1}: Username | |
# ${2}: Repository | |
# Clone the repo from GitLab using the `--mirror` option. | |
git clone --mirror "git@gitlab.com:${1}/${2}.git" | |
# Push to GitHub using the `--mirror` option. The `--no-verify` option skips any hooks. | |
git -C "${2}" push --no-verify --mirror "git@github.com:${1}/${2}.git" | |
# Set push URL to the mirror location. | |
git -C "${2}" remote set-url --push origin "git@github.com:${1}/${2}.git" | |
# To periodically update the repo on GitHub with what you have in GitLab. | |
git -C "${2}" fetch -p origin | |
git -C "${2}" push --no-verify --mirror |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment