Created
February 21, 2016 17:46
-
-
Save sandeepkunkunuru/9c1cb4a9d780f03232ce to your computer and use it in GitHub Desktop.
Checkout all your bitbucket repos in one go
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: bitbucket.sh [username] | |
curl -u ${1} https://api.bitbucket.org/1.0/users/${1} > repoinfo | |
for repo_name in $( grep -oE '\"slug\": "[^"]*"' repoinfo | cut -f4 -d\") | |
do | |
if [[ -d "${repo_name}" ]]; then | |
pushd "${repo_name}" | |
git pull origin master | |
popd | |
else | |
git clone [email protected]:${1}/${repo_name}.git | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment