Purge GitHub data

It is possible to remove certain public data without fully nuking your account.

Remove all gists

Create a PAT with read and write access to Gists.

Install the gists-gone CLI with pip(x):

pipx install gists-gone

Run via:

gists-gone --token <pat>

Unstar repos

Using a CLI

Create a PAT with Repository Metadata read and Account Starring write permissions. If that fails, use a classic access token with “repo” scope.

Run via:

bunx github-unstar

It will ask for a GitHub PAT.

Using JavaScript console in a browser

In case you are hit with rate limits after using the CLI, you can use the following script to auto-click “Unstar” buttons on all repos visible on the page.

const buttons = document.querySelectorAll(
  'button[data-aria-prefix="Starred, click to unstar this repository"]',
)

for (const btn of buttons) btn.click()

Reload the page and repeat the process until all repos are unstarred.

For starred topics use a different selector:

const buttons = document.querySelectorAll('button.starred')

for (const btn of buttons) btn.click()

Delete unused forks

Since GitHub automatically creates a fork for every edit on someone elses’ repository, a bunch of forks get left over. Use fork-cleaner to remove outdated forks with no PRs open.

If you have Go on your machine, it can be installed with a single command:

go install github.com/caarlos0/fork-cleaner/cmd/fork-cleaner@latest

Create a classical token with “delete_repos” scope and run via:

fork-cleaner --token <pat>

This will only delete empty forks. Forks with any changes, even when irrelevant, will need to be deleted manually.