Skip to content

Instantly share code, notes, and snippets.

@filipenevola
Forked from mariozig/migrate_repo.sh
Last active May 3, 2020 14:58
Show Gist options
  • Save filipenevola/df991e77d644d85524cd6375b7094c8d to your computer and use it in GitHub Desktop.
Save filipenevola/df991e77d644d85524cd6375b7094c8d to your computer and use it in GitHub Desktop.
Migrate repo from GitLab to GitHub Full blog post @ http://ruby.zigzo.com/2015/03/23/moving-from-gitlab-to-github/
REPO_NAME=website
FROM=git@gitlab.com:quave/$REPO_NAME.git
TO=git@github.com:quavedev/$REPO_NAME.git
# Assume we are in your home directory
cd ~/
# Clone the repo from GitLab using the `--mirror` option
git clone --mirror $FROM
# Change into newly created repo directory
cd ~/$REPO_NAME.git
# Push to GitHub using the `--mirror` option. The `--no-verify` option skips any hooks.
git push --no-verify --mirror $TO
# Set push URL to the mirror location
git remote set-url --push origin $TO
# To periodically update the repo on GitHub with what you have in GitLab
git fetch -p origin
git push --no-verify --mirror
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment