LinuxCommandLibrary

hub-delete

Delete a repository on GitHub

TLDR

Delete personal repo on GitHub

$ hub delete [repository]
copy

SYNOPSIS

hub delete [-y|--yes] [-h|--help] [REPOSITORY]...

PARAMETERS

-h, --help
    Display help message and exit

-y, --yes
    Skip interactive confirmation prompt

DESCRIPTION

hub delete is a subcommand of the hub tool, a lightweight wrapper around git that adds GitHub integration. It enables deletion of one or more repositories on GitHub directly from the terminal.

When run inside a git repository without arguments, it targets the current repository associated with the origin remote. Specify repository names (e.g., OWNER/REPO) to delete others. By default, a confirmation prompt appears to prevent accidental deletions; use -y to bypass it.

This command sends a DELETE request to the GitHub API, requiring proper authentication via personal access token or OAuth setup with hub auth. It supports deleting forks but not if they have open pull requests in some cases. Repositories are permanently removed, including all issues, wikis, and stars—use extreme caution as recovery is limited to GitHub support.

Ideal for scripting repository cleanup, but verify ownership and permissions first.

CAVEATS

Permanently deletes repositories and all contents (issues, PRs, wiki). Irreversible without GitHub support. Requires repo:delete permission and authentication. Fails if repo has protections enabled or lacks delete access.

AUTHENTICATION

Setup via hub auth login or GITHUB_TOKEN env var with repo scope.

EXAMPLES

hub delete
Deletes current repo (with prompt).

hub delete -y mislav/hub
Deletes without confirmation.

HISTORY

hub developed by Miroslav Malík (mislav) starting 2011 as open-source git/GitHub wrapper. hub delete added early for repo management. Project archived in 2021; GitHub now recommends official gh CLI (gh repo delete).

SEE ALSO

hub(1), git(1), gh(1)

Copied to clipboard