Deleting files in a repository

You can delete an individual file or an entire directory in your repository on GitHub.

Who can use this feature?

People with write permissions can delete files or directories in a repository.

In this article

About file and directory deletion

You can delete an individual file in your repository or an entire directory, including all the files in the directory.

If you try to delete a file or directory in a repository that you don’t have write permissions to, we'll fork the project to your personal account and help you send a pull request to the original repository after you commit your change. For more information, see "About pull requests."

If the file or directory you deleted contains sensitive data, the data will still be available in the repository's Git history. To completely remove the file from GitHub, you must remove the file from your repository's history. For more information, see "Removing sensitive data from a repository."

Deleting a file

  1. Browse to the file in your repository that you want to delete.
  2. In the top-right corner, select the

dropdown menu, then click Delete file.

Screenshot of the file list for a directory. To the right of the directory name, a button, labeled with a kebab icon, is outlined in dark orange.

Screenshot of a <a href=GitHub pull request showing a dropdown menu with options to choose the commit author email address. octocat@github.com is selected." />

Screenshot of a <a href=GitHub pull request showing a radio button to commit directly to the main branch or to create a new branch. New branch is selected." />

Deleting a directory

  1. Browse to the directory in your repository that you want to delete.
  2. In the top-right corner, select the

dropdown menu, then click Delete directory.

Screenshot of the file list for a directory. To the right of the directory name, a button, labeled with a kebab icon, is outlined in dark orange.

Screenshot of a <a href=GitHub pull request showing a dropdown menu with options to choose the commit author email address. octocat@github.com is selected." />

Screenshot of a <a href=GitHub pull request showing a radio button to commit directly to the main branch or to create a new branch. New branch is selected." />

Help and support

Help us make these docs great!

All GitHub docs are open source. See something that's wrong or unclear? Submit a pull request.