Created
May 18, 2017 07:55
-
-
Save terlar/2546b1b46d936b1d389b1417e65cea52 to your computer and use it in GitHub Desktop.
Migrate bitbucket repo 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 | |
set -xeuo pipefail | |
main() { | |
local usr="${1?user must be provided}" | |
local bb_repo="${2?bitbucket repo must be provided}" | |
local target="${bb_repo##*/}" | |
git clone --mirror "${bb_repo}" "${target}" | |
cd "${target}" || exit | |
git remote set-url --push origin "git@github.com:${usr}/${target}" | |
git push --mirror | |
} | |
main "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment