Skip to content

Instantly share code, notes, and snippets.

@terlar
Created May 18, 2017 07:55
Show Gist options
  • Save terlar/2546b1b46d936b1d389b1417e65cea52 to your computer and use it in GitHub Desktop.
Save terlar/2546b1b46d936b1d389b1417e65cea52 to your computer and use it in GitHub Desktop.
Migrate bitbucket repo to github
#!/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