Skip to content

Instantly share code, notes, and snippets.

@rafaelcorreiapoli
Last active August 30, 2019 18:49
Show Gist options
  • Save rafaelcorreiapoli/b9dcb5c25381b967fde3334a45d43403 to your computer and use it in GitHub Desktop.
Save rafaelcorreiapoli/b9dcb5c25381b967fde3334a45d43403 to your computer and use it in GitHub Desktop.
#! /bin/bash
set -exo pipefail
[[ -z "$ACCESS_TOKEN" ]] && (echo "Please set ACCESS_TOKEN" && exit 1;)
migrate_repo() {
repo=$1
curl https://api.github.com/orgs/livup/repos?access_token=${ACCESS_TOKEN} -d "{\"name\": \"${repo}\", \"description\": \"\", \"private\": true, \"has_issues\": true, \"has_downloads\": true, \"has_wiki\": false}"
git clone git@bitbucket.org:livupoficial/${repo}.git
cd ${repo}
git remote add upstream git@github.com:livup/${repo}.git
git push upstream master
git push --tags upstream
git remote remove origin
git remote rename upstream origin
}
for repo in "$@"
do
echo "Migrating $repo"
migrate_repo $repo
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment