Search code examples
gitgithubrepository

How to remove a folder from remote repository


I have a github repository which has a folder that i didnt mean to commit. I removed that folder from my local git repo, but when i push my local repo, all new changes are pushed, but the folder is still in my remote repository. how can i delete this folder from GITHUB?


Solution

  • As commenters suggested, you can delete the folder as part of a commit using git rm.

    Specifically,

    git checkout <branch name>
    git pull
    git rm -rf <folder name>
    git commit -m "<commit message>"
    git push origin <branch name>