Skip to content

Instantly share code, notes, and snippets.

View asari-fd's full-sized avatar

Takashi Asari asari-fd

  • Fairy Devices Inc.
  • Tokyo, Japan
View GitHub Profile
@asari-fd
asari-fd / backup-github.sh
Last active December 29, 2016 19:17 — forked from darktim/backup-github.sh
If you have more than 30 Repositories, the original script will not download all. The github api limits the entries to 30 per page but you can raise that up to 100. I have added a small loop which sets the limit to 90 and cycles through all pages until the listing on a page is empty...
#!/bin/bash
# A simple script to backup an organization's GitHub repositories.
GHBU_BACKUP_DIR=${GHBU_BACKUP_DIR-"github-backups"} # where to place the backup files
GHBU_ORG=${GHBU_ORG-"<CHANGE-ME>"} # the GitHub organization whose repos will be backed up
GHBU_NETRCFILE=${GHBU_NETRCFILE-"<CHANGE-ME>"} # path to the file that contains GitHub account information
# for netrc file example, see man curl(1)
GHBU_GITHOST=${GHBU_GITHOST-"<CHANGE-ME>.github.com"} # the GitHub hostname (see notes)
GHBU_PRUNE_OLD=${GHBU_PRUNE_OLD-true} # when `true`, old backups will be deleted
GHBU_PRUNE_AFTER_N_DAYS=${GHBU_PRUNE_AFTER_N_DAYS-3} # the min age (in days) of backup files to delete