{
"path": "/3mjxvieodic2w",
"site": "at://did:plc:nuc33thnsiqzhytkleyr5jek/site.standard.publication/3mjdo3xyaoc2l",
"tags": [
"forgejo",
"codeberg",
"git",
"curl",
"gitea"
],
"$type": "site.standard.document",
"title": "Mass delete repos from Forgejo, Gitea, or Codeberg",
"content": {
"$type": "pub.leaflet.content",
"pages": [
{
"id": "019dadae-b3d8-7ee0-a372-b8dbee463db8",
"$type": "pub.leaflet.pages.linearDocument",
"blocks": [
{
"$type": "pub.leaflet.pages.linearDocument#block",
"block": {
"$type": "pub.leaflet.blocks.blockquote",
"facets": [
{
"index": {
"byteEnd": 7,
"byteStart": 0
},
"features": [
{
"$type": "pub.leaflet.richtext.facet#bold"
}
]
}
],
"plaintext": "CAUTION: There is no confirmation when deleting the repos."
}
},
{
"$type": "pub.leaflet.pages.linearDocument#block",
"block": {
"$type": "pub.leaflet.blocks.text",
"plaintext": "First, you need an access token, which you can generate under User Settings -> Applications. Make sure it has at least read and write access for repository and user."
}
},
{
"$type": "pub.leaflet.pages.linearDocument#block",
"block": {
"$type": "pub.leaflet.blocks.header",
"level": 2,
"plaintext": "Delete select repos"
}
},
{
"$type": "pub.leaflet.pages.linearDocument#block",
"block": {
"$type": "pub.leaflet.blocks.code",
"language": "shellscript",
"plaintext": "#!/usr/bin/env bash\n\nset -euo pipefail\n\n# Change the values below to your own. The values below are just examples.\nINSTANCE_URL=https://codeberg.org\nINSTANCE_USER=hyperreal\nINSTANCE_TOKEN=cd188e90f2f03eed57b1971fb16329b1b919a2bb\n\n# Add the repository names to an array. E.g., if your repo is located at \n# https://codeberg.org/hyperreal/dotfiles, the name you would add would be \"dotfiles\".\nrepos=(\"repo0\" \"repo1\" \"dotfiles\" \"repo2\")\n\n# Iterate through the array and delete each item using curl.\nfor repo in \"${repos[@]}\"; do\n echo \"Deleting repository: ${repo}\"\n curl -s \\\n -u \"${INSTANCE_USER}:${INSTANCE_TOKEN}\" \\\n -X DELETE \\\n \"${INSTANCE_URL}/api/v1/repos/${INSTANCE_USER}/${repo}\"\ndone\n\necho \"All your repos are belong to internet abyss! Arrivederci, baby!\"\n",
"syntaxHighlightingTheme": "catppuccin-mocha"
}
},
{
"$type": "pub.leaflet.pages.linearDocument#block",
"block": {
"$type": "pub.leaflet.blocks.header",
"level": 2,
"plaintext": "Delete all the repos"
}
},
{
"$type": "pub.leaflet.pages.linearDocument#block",
"block": {
"$type": "pub.leaflet.blocks.text",
"facets": [
{
"index": {
"byteEnd": 140,
"byteStart": 98
},
"features": [
{
"$type": "pub.leaflet.richtext.facet#code"
}
]
}
],
"plaintext": "If for whatever reason you want to delete all the repos on your account, change the line with the repos=(\"repo0\" \"repo1\" \"dotfiles\" \"repo2\") array to the following."
}
},
{
"$type": "pub.leaflet.pages.linearDocument#block",
"block": {
"$type": "pub.leaflet.blocks.code",
"language": "shellscript",
"plaintext": "readarray -t repos < <(curl -s -u \"${INSTANCE_USER}:${INSTANCE_TOKEN} \"${INSTANCE_URL}/api/v1/users/${INSTANCE_USER}/repos?limit=100\" | jq -r '.[].name')",
"syntaxHighlightingTheme": "catppuccin-mocha"
}
},
{
"$type": "pub.leaflet.pages.linearDocument#block",
"block": {
"$type": "pub.leaflet.blocks.text",
"plaintext": ""
}
}
]
}
]
},
"bskyPostRef": {
"cid": "bafyreib2yg5voyi4cj5c6v5ubjenwttqnhedzunyrkuyj2launuall2oou",
"uri": "at://did:plc:nuc33thnsiqzhytkleyr5jek/app.bsky.feed.post/3mjxvij5dns2w",
"commit": {
"cid": "bafyreif4pqa46tgw3vxw5isiimuxac5ddl7r6wsuksmpuwxmkxwcefjolq",
"rev": "3mjxvij7sr22t"
},
"validationStatus": "valid"
},
"description": "A simple bash script to delete select repos from Forgejo/Codeberg using the API",
"publishedAt": "2026-04-21T02:06:20.855Z"
}