How to find all active GitHub Codespaces?

Update: It's now possible to view Codespaces in GitHub: github.com/codespaces

Today, I've run out of GitHub Codespaces storage.

Screenshot from 2022-11-18 20-25-28.png

It was a bit surprising to me, as I haven't used codespaces in a while, so I wanted to check if maybe I've got some active ones.

I couldn't find any way on GitHub itself to find a list of active codespaces and going through almost 300 repos was definitely not an option.

Fortunately, there is an endpoint, that lists codespaces for authenticated user and if you've got GitHub CLI you can easily use it from the terminal.

> gh codespace list

Probably, like me, you want have required and will get a following error:

error getting codespaces: HTTP 403: Must have admin rights to Repository. (https://api.github.com/user/codespaces?per_page=30)
This API operation needs the "codespace" scope. To request it, run:  gh auth refresh -h github.com -s codespace

Follow the instructions and after running the command again you should get a list of your active codespaces:

sitek@ubuntu-desktop:~$ gh codespace list
NAME                                               DI...  REPO  BRAN  STAT  CREA
sitek94-gh-codespaces-demo-5wg4jrjgf4r5            su...  site  main  Shut  May 
sitek94-tailwindlabs-tailwindcss-com-xj597p75cwwq  li...  tail  mast  Shut  Jun 
sitek94-tailwindcss-com-4xjg5v5jfq5g4              fi...  site  docs  Shut  Jun

Now, you see all your active codespaces and you can cancel the ones, that you don't use anymore.


Â