Last active
April 7, 2021 13:18
-
-
Save daniel-vera-g/fcecac7103cae23ddfc80306d22fa7f0 to your computer and use it in GitHub Desktop.
Migrate multiple repositories from github to gitlab
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 | |
# To be used with: https://gist.github.com/daniel-vera-g/dc4df64ed1064406c8956f588c538d41 | |
# Migrate multiple repositories from github to gitlab | |
# Name of repos to migrate | |
reposToMigrate=('') | |
# Name of gitlab domain | |
# If gitlab.com, adjust url below | |
domain='' | |
# User | |
user='' | |
for repo in "${reposToMigrate[@]}"; do | |
echo '--------------' | |
echo "Checking out: " $repo | |
echo '--------------' | |
# Clone from gitlab | |
git clone git@git.$domain.com:$user/$repo.git | |
cd $repo | |
echo '--------------' | |
echo "Create project on github" | |
echo "Uses github 'gh' cli tool" | |
echo '--------------' | |
# Optional --private and -t [team-name] flag(See gh --help) | |
gh repo create $repo -y | |
git remote add github git@github.com:$user/$repo | |
echo '--------------' | |
echo "Push all local branches and tags" | |
echo '--------------' | |
git push github --all | |
cd .. | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment