Skip to content

Instantly share code, notes, and snippets.

@tonyyates
Created October 15, 2019 07:58
Show Gist options
  • Save tonyyates/d8ec2b00af54b724f323d984f3e910b1 to your computer and use it in GitHub Desktop.
Save tonyyates/d8ec2b00af54b724f323d984f3e910b1 to your computer and use it in GitHub Desktop.
Simple bash script for looping through an org and downloading all repos for save keeping
#!/bin/bash
ORG=$1
echo $ORG
mkdir $ORG
cd $ORG
curl -H 'Authorization: token <insert>' -s https://api.github.com/orgs/$ORG/repos | ruby -rjson -e 'JSON.load(STDIN.read).each {|repo| %x[git clone #{repo["ssh_url"]} ]}'
cd ..
tar -cvf $ORG-$(date +%Y-%m-%d).tar.gz $ORG/*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment