Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Mirror all organization repositories
org="whitehouse"
for repo in $(curl -v -s "https://api.github.com/orgs/$org/repos?per_page=100&type=sources" 2>&1 | grep '"full_name": "*"' | cut -d':' -f2 | sed s'/,$//' | sed s'/"//g' ); do
filename=$(echo "$repo" | cut -d'/' -f2)
echo "Downloading $repo..."
curl -o "$filename.zip" -L "https://github.com/$repo/archive/master.zip"
done
@Frankkkkk
Copy link

#!/bin/bash

org="$1"

if [ -z $org ]; then
	echo "Usage: $0 <organisation>"
	exit 1
fi

mkdir -p $org
pushd $org

for repo in $(curl -v -s "https://api.github.com/orgs/$org/repos?per_page=100&type=sources" 2>&1 | grep '"full_name": "*"' | cut -d':' -f2 | sed s'/,$//' | sed s'/"//g' ); do

	filename=$(echo "$repo" | cut -d'/' -f2)
	if [ -e $filename ]; then
		pushd $filename
		git pull
		popd
	else
		git clone git@github.com:$repo.git
	fi
done

popd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment