|
| 1 | +--- |
| 2 | +title: Deleting files in a repository |
| 3 | +intro: 'You can delete an individual file{% if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "enterprise-server@3.0" %} or an entire directory{% endif %} in your repository on {% data variables.product.product_name %}.' |
| 4 | +redirect_from: |
| 5 | + - /articles/deleting-files |
| 6 | + - /github/managing-files-in-a-repository/deleting-files |
| 7 | + - /github/managing-files-in-a-repository/deleting-a-file-or-directory |
| 8 | +versions: |
| 9 | + free-pro-team: '*' |
| 10 | + enterprise-server: '*' |
| 11 | + github-ae: '*' |
| 12 | +permissions: People with write permissions can delete files{% if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "enterprise-server@3.0" %} or directories{% endif %} in a repository. |
| 13 | +--- |
| 14 | + |
| 15 | +### About file{% if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "enterprise-server@3.0" %} and directory{% endif %} deletion |
| 16 | + |
| 17 | +You can delete an individual file in your repository{% if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "enterprise-server@3.0" %} or an entire directory, including all the files in the directory{% endif %}. |
| 18 | + |
| 19 | +If you try to delete a file{% if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "enterprise-server@3.0" %} or directory{% endif %} in a repository that you donβt have write permissions to, we'll fork the project to your user account and help you send a pull request to the original repository after you commit your change. For more information, see "[About pull requests](/github/collaborating-with-issues-and-pull-requests/about-pull-requests)." |
| 20 | + |
| 21 | +If the file{% if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "enterprise-server@3.0" %} or directory{% endif %} you deleted contains sensitive data, the data will still be available in the repository's Git history. To completely remove the file from {% data variables.product.product_name %}, you must remove the file from your repository's history. For more information, see "[Removing sensitive data from a repository](/github/authenticating-to-github/removing-sensitive-data-from-a-repository)." |
| 22 | + |
| 23 | +### Deleting a file |
| 24 | + |
| 25 | +1. Browse to the file in your repository that you want to delete. |
| 26 | +2. At the top of the file, click {% octicon "trashcan" aria-label="The trashcan icon" %}. |
| 27 | +{% data reusables.files.write_commit_message %} |
| 28 | +{% data reusables.files.choose-commit-email %} |
| 29 | +{% data reusables.files.choose_commit_branch %} |
| 30 | +{% data reusables.files.propose_file_change %} |
| 31 | + |
| 32 | +{% if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "enterprise-server@3.0" %} |
| 33 | +### Deleting a directory |
| 34 | + |
| 35 | +1. Browse to the directory in your repository that you want to delete. |
| 36 | +1. In the top-right corner, click {% octicon "kebab-horizontal" aria-label="The horizontal kebab icon" %}, then click **Delete directory**. |
| 37 | +  |
| 38 | +1. Review the files you will delete. |
| 39 | +{% data reusables.files.write_commit_message %} |
| 40 | +{% data reusables.files.choose-commit-email %} |
| 41 | +{% data reusables.files.choose_commit_branch %} |
| 42 | +{% data reusables.files.propose_file_change %} |
| 43 | +{% endif %} |
0 commit comments