Move private repos from Bitbucket to GitHub


Now that Github supports unlimited private repos in all plans, you might as well keep things all together (although definitely have backups elsewhere incase Github is DDOS’d again, dies or goes evil). Simply change “rubenwardy” to your username and “XXXX” to a personal access token with “repo” checked. Also make sure you have an SSH key for Github.

# Clone from bitbucket
git clone
mkdir bk
cd bitbucket-backup
./bitbucket-backup -u rubenwardy --mirror -l ../bk

# Upload to GitHub
cd ../bk
for D in *;
    echo $D
    cd $D
    data="{\"name\": \"$D\", \"auto_init\": false, \"private\": true }"
    curl -i -H 'Authorization: token XXXX' -d "$data"
    git push --mirror$D.git
    cd ../
cd ../