Skip to content

Instantly share code, notes, and snippets.

@rhysburnie
Created April 22, 2017 01:00
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 rhysburnie/02d627ae7e83c816270cd9974b760e9c to your computer and use it in GitHub Desktop.
Save rhysburnie/02d627ae7e83c816270cd9974b760e9c to your computer and use it in GitHub Desktop.
backup (and optional delete) repositories
#!/bin/bash
USER=;
PAGE=1;
curl "https://api.github.com/users/$USER/repos?page=$PAGE&per_page=100" |
grep -e 'git_url*' |
cut -d \" -f 4 |
xargs -L1 git clone
#!/bin/bash
# WARNING BACKUP FIRST
# ===
# ALSO THIS TARGETS ALL
# ===
# You need to get a token:
# https://github.com/settings/tokens/new
# with permission: delete_repo
DELETE_TOKEN=;
USER=;
PAGE=1;
curl "https://api.github.com/users/$USER/repos?page=$PAGE&per_page=100" |
grep -e '^ "url":' |
cut -d \" -f 4 |
xargs -L1 curl -X DELETE -H "Authorization: token $DELETE_TOKEN"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment