Skip to content

Instantly share code, notes, and snippets.

@dreikanter
Last active March 8, 2022 02:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dreikanter/7c70a32215a2eb71c98b11cf0570b412 to your computer and use it in GitHub Desktop.
Save dreikanter/7c70a32215a2eb71c98b11cf0570b412 to your computer and use it in GitHub Desktop.
Keep your 🧳 together

Create Github access token: https://github.com/settings/tokens

Setup backup tool:

pip3 install github-backup

export GITHUB_BACKUP_TOKEN=ghp_bananabananabananabananabananabanana
export GITHUB_BACKUP_USER=dreikanter
export GITHUB_BACKUP_PATH=~/github-backup/$GITHUB_BACKUP_USER

Backup a user:

mkdir -p $GITHUB_BACKUP_PATH

github-backup \
  --token $GITHUB_BACKUP_TOKEN \
  --output-directory $GITHUB_BACKUP_PATH \
  --starred \
  --followers \
  --following \
  --increment \
  --issues \
  --issue-comments \
  --pulls \
  --pull-comments \
  --pull-commits \
  --pull-details \
  --labels \
  --repositories \
  --wikis \
  --gists \
  --private \
  --fork \
  --releases \
  $GITHUB_BACKUP_USER

Add --organization flag if $GITHUB_BACKUP_USER is an organization:

mkdir -p $GITHUB_BACKUP_PATH

github-backup \
  --token $GITHUB_BACKUP_TOKEN \
  --output-directory $GITHUB_BACKUP_PATH \
  --starred \
  --followers \
  --following \
  --increment \
  --issues \
  --issue-comments \
  --pulls \
  --pull-comments \
  --pull-commits \
  --pull-details \
  --labels \
  --repositories \
  --wikis \
  --gists \
  --private \
  --fork \
  --releases \
  --organization \
  $GITHUB_BACKUP_USER

References:

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