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 git@github.com:samkuehn/bitbucket-backup.git
mkdir bk
cd bitbucket-backup
./bitbucket-backup -u rubenwardy --mirror -l ../bk

# Upload to GitHub
cd ../bk
for D in *;
do
	echo $D
	cd $D
	data="{\"name\": \"$D\", \"auto_init\": false, \"private\": true }"
	curl -i -H 'Authorization: token XXXX' -d "$data" https://api.github.com/user/repos
	git push --mirror git@github.com:rubenwardy/$D.git
	cd ../
done
cd ../
Comments

Comments are currently disabled whilst we remove the dependency on a third party service which was taken offline. In the meantime, feel free to send a message to me on Twitter.