How to delete a repository on GitHub

Kenny DuMez
Kenny DuMez
Graphite software engineer


Note

This guide explains this concept in vanilla Git. For Graphite documentation, see our CLI docs.


Deleting a repository on GitHub is a relatively straightforward process, but it's important to understand the implications of doing so. This guide provides detailed instructions on how to delete a GitHub repository, branch, and files within a repository. Whether you need to clean up old projects or remove unnecessary data, following these steps will ensure you do so correctly and safely.

Note: Even if a repository is deleted, other may still be able to access its data. See this guide on deleting sensitive information from GitHub for more information and detailed instructions.

Warning: Deleting a repository is permanent and cannot be undone. It removes all the files, branches, and history associated with the repository.

  1. Log in to GitHub: Open your web browser and go to GitHub. Enter your username and password to log in.
  2. Navigate to the repository: Click on your profile photo in the upper-right corner, then select "Your repositories" from the dropdown menu. Find the repository you want to delete and click on it to open.
  3. Go to the settings: Inside the repository, find the "Settings" tab near the top of the page and click on it.
  4. Scroll down to the Danger Zone: At the bottom of the settings page, you will see a section called "Danger Zone."
  5. Delete the repository: In the Danger Zone, you'll find a button labeled "Delete this repository." Click it.
  6. Confirm deletion: GitHub will ask you to confirm the deletion by typing the name of the repository. Type the repository name and click the "I understand the consequences, delete this repository" button to permanently delete the repository.

Deleting a branch in GitHub removes that specific line of development. Here’s how to delete a branch:

  1. Navigate to your repository as described above.
  2. Go to the branches page: Click on the "Branches" tab next to the "Code" tab.
  3. Find the branch you want to delete: Locate the branch in the list, then click on the trash can icon next to the branch you wish to delete.

Sometimes, you only need to remove specific files rather than the entire repository or a branch. Here’s how to delete files:

  1. Navigate to your repository and find the file you wish to delete.
  2. Open the file: Click on the file to open it.
  3. Edit or delete the file: Click on the trash can icon at the top right of the file view.
  4. Commit the change: After clicking the trash can, you will be directed to a new page to commit the change. Enter a commit message explaining why you are deleting the file. Select the "Commit changes" button.
  • Backup before deletion: Before deleting anything on GitHub, consider backing up the data if you might need it later.
  • Check dependencies: Ensure that no other projects depend on the repository, branch, or files you are planning to delete.
  • Understand the impact: Deletion could impact any continuous integration/continuous deployment (CI/CD) pipelines that rely on the repository.

For more information see the official GitHub documentation.

Graphite
Git stacked on GitHub

Stacked pull requests are easier to read, easier to write, and easier to manage.
Teams that stack ship better software, faster.

Or install our CLI.
Product Screenshot 1
Product Screenshot 2