Skip to content

Instantly share code, notes, and snippets.

@nioq
Created May 29, 2020 07:54
Show Gist options
  • Save nioq/5ada9a4def86fee89abd41fa4b1e3f3b to your computer and use it in GitHub Desktop.
Save nioq/5ada9a4def86fee89abd41fa4b1e3f3b to your computer and use it in GitHub Desktop.
Generate a CSV list of all Bitbucket repositories you have access to. From https://github.com/Tinkertanker/bitbucket-github-migration
#!/bin/bash
read -p 'Bitbucket Username (not email): ' BB_USERNAME
read -sp 'Bitbucket Password: ' BB_PASSWORD
next_url="https://api.bitbucket.org/2.0/repositories?role=member"
while [ ! -z "$next_url" ]; do
response_json=$( curl -s --user $BB_USERNAME:$BB_PASSWORD "$next_url" )
echo "$response_json" | jq -r '.values | map([.slug, .workspace.slug, .description, .is_private] | @csv) | join("\n")'
next_url=$( echo "$response_json" | jq -r '.next' )
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment