Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

download all bitbucket repositories

#!/bin/bash

USER=${1}
TEAM=${2}

rm -rf "$TEAM" && mkdir "$TEAM" && cd $TEAM

NEXT_URL="https://api.bitbucket.org/2.0/repositories/${TEAM}?pagelen=100"

while [ ! -z $NEXT_URL ] && [ $NEXT_URL != "null" ]
do
    curl -u $USER $NEXT_URL > repoinfo.json
    jq -r '.values[] | .links.clone[1].href' repoinfo.json > ../repos.txt
    NEXT_URL=`jq -r '.next' repoinfo.json`

    for repo in `cat ../repos.txt`
    do
        echo "Cloning" $repo
        if echo "$repo" | grep -q ".git"; then
            command="git"
        else
            command="hg"
        fi
        $command clone $repo
    done
done

cd ..
Comment

PREVIOUS NEXT
Code Example
Shell :: mv bash 
Shell :: bash cd || exit 
Shell :: yacc install in kali linux 
Shell :: float calculation bash 
Shell :: ruby on rails install 
Shell :: greater than certain value from pipe shell 
Shell :: windows battery report health 
Shell :: how to run "npm start" ansible pm2 
Shell :: download sklearn linux 
Shell :: ansible ad hoc file module 
Shell :: git unstage a file 
Shell :: Failed to start uWSGI Emperor Service 
Shell :: Date time in linux prompt 
Shell :: git passphrase remember 
Shell :: get all changes on commit name 
Shell :: bash add default argument 
Shell :: linux create directory 
Shell :: fetch from remote branch 
Shell :: creating icon for nativescript app 
Shell :: ubuntu delete all virtual hosts 
Shell :: teamcity set environment variable command line 
Shell :: zsh terminal 
Shell :: docker get in python container 
Shell :: helm commands 
Shell :: how to activate conda/Anaconda environment 
Shell :: jupyter command install 
Shell :: linux check current umask 
Shell :: insert image into github wiki 
Shell :: generate table of content in readme.md 
Shell :: kubectl logs with grep 
ADD CONTENT
Topic
Content
Source link
Name
8+5 =