Skip to content

Instantly share code, notes, and snippets.

@sandeepkunkunuru
Created February 21, 2016 17:46
Show Gist options
  • Save sandeepkunkunuru/9c1cb4a9d780f03232ce to your computer and use it in GitHub Desktop.
Save sandeepkunkunuru/9c1cb4a9d780f03232ce to your computer and use it in GitHub Desktop.

Revisions

  1. sandeepkunkunuru created this gist Feb 21, 2016.
    15 changes: 15 additions & 0 deletions bitbucket.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    #!/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