Mass deleting github repos

can repos get deleted with redact in bulk?

redact mass deletes comments, stars, follows, and gists. if you want to delete your repos read this guide.

2 Likes

If you’re trying to wipe a bunch fast, you’ve got a few real options:

  • Archive instead (way safer) makes them basically ā€œgoneā€ from view but you can undo it if you panic later lol

  • GitHub CLI: easiest way to bulk manage stuff without clicking 200 times

  • API script: if you want rules like ā€œdelete everything with prefix test-ā€ or ā€œolder than 2022ā€ or whatever

Before you go full send:

  • if any of these are org repos you might not even have permission or the org can block deletes

  • maybe do an archive pass first and then wait a day then delete once you’re sure you didn’t just yeet something important

you ever heard of repo reaper? I’ve never used it but have heard good things about it, it’s made specifically to remove repos in bulk: https://reporeaper-frontend.onrender.com/

it was just released in Aug of 25’, so not much feedback about it yet. if you decide to use it report back on how you like it, I am curious.

1 Like

doesnt github allow for mass repo delting, like as a native feature within github admin? I believe they do. although, the fact someone made repo reaper maybe points to the contrary. I don’t know, I’m not a big github user.

No, @D-Mag is wrong actually. There are no mass delete options within github, you gotta use a 3rd party app.

I have personally used https://reposweeper.com/ and it worked as intended. They also have repo reaper, linked up above in trigger’s post.

Read this: Bulk delete github repos Ā· GitHub

Use this trick to bulk delete your old repos or old forks

(Inspired by https://medium.com/@icanhazedit/clean-up-unused-github-rpositories-c2549294ee45#.3hwv4nxv5)

  1. Open in a new tab all to-be-deleted github repositores (Use the mouse’s middle click or Ctrl + Click) https://github.com/username?tab=repositories

  2. Use one tab https://chrome.google.com/webstore/detail/onetab/chphlpgkkbolifaimnlloiipkdnihall to shorten them to a list.

  3. Save that list to some path

  4. The list should be in the form of ā€œur_username\repo_nameā€ per line. Use regex search (Sublime text could help). Search for ’ |.*’ and replace by empty.

  5. Register a new personal access token with a ā€˜delete_repo perm’ https://github.com/settings/tokens/new

  6. Copy the access_token and run the following line replacing xxx with your access token.

Linux and OS X :

while read r;do curl -XDELETE -H 'Authorization: token xxx' "https://api.github.com/repos/$r ";done < repos

Windows:

get-content D:\repolist.txt | ForEach-Object { Invoke-WebRequest -Uri https://api.github.com/repos/$_ -Method ā€œDELETEā€ -Headers @{"Authorization"="token xxx"} }

Caution

I have only tested this script on Linux.

fyi there is also a browser extension for deleting the repos https://chromewebstore.google.com/detail/npleadnddajjokllpjmpkekijopogeci?utm_source=item-share-cb

I’ve used that browser extension, it does what it says it does.