Skip to content
Discussion options

You must be logged in to vote

To delete a repository with the GitHub REST API, you can use the DELETE /repos/{owner}/{repo} endpoint.

Here’s how it works:

Endpoint:

DELETE https://api.github.com/repos/OWNER/REPO

Headers:

Authorization: Bearer YOUR_GITHUB_TOKEN
Accept: application/vnd.github+json

Example using curl:

curl -X DELETE
-H "Authorization: Bearer ghp_yourtokenhere"
-H "Accept: application/vnd.github+json"
https://api.github.com/repos/yourusername/old-repo

Permissions required:

You must own the repository or have admin access.

Your token must include the delete_repo scope.

After running the command, GitHub will permanently delete the repository.
This action cannot be undone, so it’s best to test on a tempor…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@doguexp
Comment options

Answer selected by doguexp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API and Webhooks Discussions related to GitHub's APIs or Webhooks Question Ask and answer questions about GitHub features and usage
2 participants