Skip to content

Instantly share code, notes, and snippets.

@soberich
Created April 30, 2020 18:54
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save soberich/0b3fb069a950f3c2b408a588db93a6e5 to your computer and use it in GitHub Desktop.
Save soberich/0b3fb069a950f3c2b408a588db93a6e5 to your computer and use it in GitHub Desktop.
Bulk clone repos in Bitbucket REST Api 2.0
# prerequisites: `httpie`, `jq`, GNU's `parallel`. e.g. brew install <package>
# there is max 100 page length n pages where n is 100 length page. Execute one one by one (there is no way you'll get more than 100 times parallelization)
# in `.values[].links.clone[1].href` `1` is for SSH, where `0` would be for HTTPS.
http https://<user>:<pass>@api.bitbucket.org/2.0/repositories/<account_name> pagelen==100 page==<page_num> | jq -r '.values[].links.clone[1].href' | parallel git clone
# Voila it takes approx 1-2 minutes to clone a 100 repos.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment