As I am continuing to check items off my TODO list before school starts, I have come to an item I have been putting off for a while. Clean up GitHub Account. Luckily, I discovered a little trick to make the process of deleting unused repos a little easier!
I could have automated this, but I prefer a little control. To get the list, start by opening up a new Firefox window with a single tab. In this tab, open your GitHub profile to the list of repos. Starting from the top, scroll through, and middle click on anything you want to delete. This opens it in a new tab.
Once you have a bunch of tabs open with repos to remove, use this Firefox plugin to create a plaintext list of every link you opened, and paste the list of links into VS-code.
Next, an API token is needed. Go to GitHub’s token settings, and generate a new one (make sure to enable repository deletion).
With our new token, and out VS-code file, we can start “parsing” the data.
CTRL + F brings up the Find/Search toolbar. In the text box, there are a few icons. Pressing the one farthest to the right will enable Regex mode. With this set, paste the following:
Now, click the arrow on the left to enable replace mode, and put this in the new box:
curl -XDELETE -H 'Authorization: token <API token from above>' "https://api.github.com/repos/
Then press replace all.
Finally, replace the contents of the first box with:
and the second with:
and replace all again.
Simply copy the entire text file that was made, and paste it in a terminal, then press <enter> (this will take a while)
Thank you for reading this post. If you enjoyed the content, and want to let me know, or want to ask any questions, please contact me via one of the methods listed here. If you would like to be notified about future posts, feel free to load my rss feed into your favorite feed reader, or follow me on Twitter for notifications about my work and future posts.
If you have the time to read some more, I recommend checking out one of the following posts: