Skip to content

[GitHub] How to Remove GitHub Specific Folder of Repository

Last Updated on 2021-10-23 by Clay

After we pushing the project that we developed to GitHub repository, if we want to rename or remove a folder, we cannot rename and re-push. It will cause the old version folder still exist.


How to delete folder

If you want to remove the specific folder on GitHub, you need to use the following command via terminal:

git rm -r --cached FOLDER_NAME
git commit -m "YOUR_COMMENT"
git push -u origin main


The meanings of these steps as follow:

  1. git rm -r --cached FOLDER_NAME: Remove the specific name folder in cache.
  2. git commit -m "YOUR_COMMENT": Commit your comment message.
  3. git push -u origin main: Push it again.

At this way, you can easily remove the specific name folder in GitHub repository.


References


Read More

Tags:

Leave a Reply