Clone all repositories from a user (bitbucket) - API2.0

Author
Published

February 18, 2020

My post about cloning all bitbucket, originally posted on my old wordpress blog, got some attention over the internet. Well, three or four mentions. Sadly the information in there has been outdated due to Bitbucket’s API changes. That added to the shocking decision by Bitbucket to stop supporting mercurial repos and delete them (!) pushed me to finally download all my repos (again) and eventually move to gitlab. Maybe in a follow up post I will detail how I converted all hg repos to git.

June 1, 2020: users will not be able to use Mercurial features in Bitbucket or via its API and all Mercurial repositories will be removed.

Donwload data for all repositories

The first step is to download as much information as possible to parse from that the download links.

WARNING: if you have more than 100 repositories keep reading.

 USER=username
 PASS=password

# source: https://stackoverflow.com/questions/40429610/bitbucket-clone-all-team-repositories
curl --user $USER:$PASS https://api.bitbucket.org/2.0/repositories/$USER?pagelen=100 > repoinfo.json

Reuse

Citation

BibTeX citation:
@online{domingues2020,
  author = {Domingues, António},
  title = {Clone All Repositories from a User (Bitbucket) - {API2.0}},
  date = {2020-02-18},
  url = {https://amjdomingues.com/posts/2020-02-16-clone-all-bitbucket-repos/},
  langid = {en}
}
For attribution, please cite this work as:
Domingues, António. 2020. “Clone All Repositories from a User (Bitbucket) - API2.0.” February 18, 2020. https://amjdomingues.com/posts/2020-02-16-clone-all-bitbucket-repos/.