Migrate Bitbucket repositories to GitHub

Just before Christmas, I got an email from Bitbucket saying that inactive workspaces will be deleted.

Almost 20 years ago, I created a Bitbucket workspace to host my university stuff (mostly for my research thesis and various papers).

And while I have the final PDFs, I did not want all that LaTeX to go to waste, so I decided to migrate everything to GitHub (which, since 20 years ago, added private repositories to their free offering).

Creating these scripts is a use case where LLMs really shine—although I had to doctor it a bit, as the way it concocted to create repositories on GitHub didn’t work.

The final script is in this gist, and to use it you need the GitHub CLI utility gh installed (see the instructions if you don’t have it) and ready to go.

Once that is done, it’s a matter of writing the names of your repositories in a file called, f.e., repos.txt and then calling the script:

BB_WORKSPACE=your_bitbucket_workspace \
GH_OWNER=your_github_username \
./migrate-bitbucket.sh repos.txt

After a while, depending on the number of repositories, you should see

🎉 All migrations complete.

Notes: