Last active
February 19, 2016 12:26
-
-
Save emad-elsaid/bef36a9e76707d0c3253 to your computer and use it in GitHub Desktop.
Clone all bitbucket repositories to directory
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#Script to get all repositories under a user from bitbucket | |
#Usage: getAllRepos.sh [username] | |
#source: http://haroldsoh.com/2011/10/07/clone-all-repos-from-a-bitbucket-source/ | |
curl -u ${1} https://api.bitbucket.org/1.0/users/${1} > repoinfo | |
# curl -u adomingues https://api.bitbucket.org/1.0/users/adomingues | |
# cat repoinfo | |
for repo_name in `cat repoinfo | sed -r 's/("name": )/\n\1/g' | sed -r 's/"name": "(.*)"/\1/' | sed -e 's/{//' | cut -f1 -d\" | tr '\n' ' '` | |
do | |
echo "Cloning " $repo_name.git | |
git clone [email protected]:${1}/$repo_name.git | |
echo "---" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment