#!/bin/bash
#Script to get all repositories under a user from bitbucket
#Usage: getAllRepos.sh [username]

curl -u ${1}  https://api.bitbucket.org/1.0/users/${1} > repoinfo
for repo_name in `grep \"name\" repoinfo | cut -f4 -d\"`
do
       git clone [email protected]:${1}/$repo_name.git
done

Credit to Harold Soh (http://haroldsoh.com/2011/10/07/clone-all-repos-from-a-bitbucket-source/) for the original source.