Shell script - easily move repositories from Bitbucket to GitHub (or GitHub to BitBucket)
Thu, 25 October 2018
git-mirror.sh
#!/usr/bin/env sh DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) cd ${DIR} GIT_PATH="/usr/bin/env git" IFS='/' read -ra PATH <<< "${1}" for i in "${PATH[@]}"; do if [[ "${i}" != *"@"* ]]; then DIRECTORY="${i}" `${GIT_PATH} clone --mirror "${1}" "${DIRECTORY}"` `cd "${DIR}/${DIRECTORY}" && ${GIT_PATH} remote set-url origin "${2}" && ${GIT_PATH} push --force` fi done
usage.txt
./git-mirror.sh git@bitbucket.org:myusername/myrepository.git git@github.com:pathto/github-version.git