Github bills per repository. Moving unused repositories to an archival tier can reduce costs. You can still use Github for your daily flow, but not pay for untouched data.
- Clone a repository.
- Clean branches.
- Add the new remote and push master.
- Push all other branches.
- Backup issues & PRs.
- Commit and push the issues/pr json files to aws
- delete the github repository
deleting merged branches
git branch -r --merged | grep -v master | awk -F/ '{print ":"$2}' | xargs -n 1 git push -q origin
push branches
for x in `git branch -r | grep -v master | awk -F/ '{print $2}'` ; do git checkout -q $x ; git push -q aws $x ; done
(NOTE: I have push.default = current
in my git config,
otherwise you could probably do a single push after all the checkouts.)
backup issues
curl --user xtoddx:PASSWORD --header "X-GitHub-OTP: XXXXXX" https://api.github.com/repos/ORG/REPO/issues > gh-issues.json
curl --user xtoddx:PASSWORD --header "X-GitHub-OTP: XXXXXX" https://api.github.com/repos/ORG/REPO/pulls > gh-pull-requests.json
(NOTE: If you don't have two factor auth enabled, you don't need to pass the header. If you do this for many repos at one time, you may want to grab a more stable oauth token instead of constantly updating your OTP header.)