6

I have a folder called "Serverside Project" that I want to delete from my git repo online. I can't seem to be able to get rid of it! How do I remove it?

enter image description here

ifusion
  • 2,007
  • 6
  • 17
  • 36

1 Answers1

47

You can just delete the folder locally and then push, ex:
rm -rf folder
git add .
git commit -a -m "removed folder"
git push origin master

Mauricio Trajano
  • 2,007
  • 1
  • 14
  • 23
  • 2
    The problem is I have deleted the folder on my local drive which is at another location but the folder is still in my online repo, so I want to delete the folder 'Serverside Project' from my online repo then pull all the other folders and files that are on my online repo atm. – ifusion Nov 10 '14 at 06:55
  • 1
    Oh I see, then why don't you clone the repo delete the folder then push? – Mauricio Trajano Nov 10 '14 at 06:57
  • 7
    @MauricioTrajano you can do it faster using `git rm -r folder` – Chris Maes Nov 10 '14 at 06:58
  • I tried doing that and this is what I got: `$ git rm -r Serverside Project` `fatal: pathspec 'Serverside' did not match any files` – ifusion Nov 10 '14 at 07:08
  • 5
    Spaces are treated as separate arguments do `git rm -r Serverside\ Project` – Mauricio Trajano Nov 10 '14 at 07:10
  • 2
    These steps were a life saver for me! Thank you! – Ascalonian May 27 '15 at 12:13
  • @Chris Maes - thanks. yes and my repo was still in the local cache - was able to remove it via https://stackoverflow.com/a/7927283 - it then removed it from the server after push – SpeedCoder5 Mar 01 '18 at 14:55